You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SVN转Git迁移时git push及git fetch报错求助

问题解决步骤

1. 修复git push参数错误

你执行的git push -u origin -–all里的-–all使用了全角破折号,Git无法识别该参数,替换为半角双短横线即可:

git push -u origin --all

2. 解决远程分支不存在问题

git fetch origin main报错是因为新建的远程Git仓库还没有main分支,先检查本地分支列表:

git branch -a

如果本地迁移后的默认分支是master,直接推送本地分支到远程并设置跟踪:

git push -u origin master

3. 验证本地仓库有效性

迁移后先确认本地仓库有提交记录,避免生成空仓库:

git log --oneline

如果无任何提交,重新检查SVN迁移流程:

  • 确认SVN仓库地址正确且有权限访问
  • 迁移时是否正确映射SVN用户到Git用户(比如git svn init时的--authors-file参数)
  • 确认git svn fetch已完成所有历史版本拉取

4. 迁移工具问题排查

使用svn2git或reposurgeon时注意以下要点:

  • svn2git需匹配SVN仓库布局,标准布局执行命令示例:
    svn2git http://svn-repo-url --trunk trunk --branches branches --tags tags --authors authors.txt
    
  • reposurgeon需先导出完整的SVN dump文件再转换:
    svnadmin dump /path/to/svn/repo > repo.dump
    reposurgeon -s repo.dump repo.rg
    

内容的提问来源于stack exchange,提问作者Ram

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 08:57:07