ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

svn前移至git 保留提交记录

2021-05-25 20:02:10  阅读:157  来源: 互联网

标签:svn origin git -- gitlab com 前移


  1. 生成一个authors.txt文件。这将包含您的SVN用户和Gitlab用户之间的映射: 可以跳过

    • 从现有的svn存储库中: svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors.txt
    • 否则,请按照以下格式手动创建它:

      oldSVNusername = newGitlabUsername <gitlabRegisteredEmailAddress@example.com>

  2. 创建一个临时目录初始化SVN存储库

    • mkdir temp
    • cd temp
    • git svn init --no-metadata http://username:password@example.com:81/svn/myrepository
  3. 配置git

    • git config svn.authorsfile ~/authors.txt 可以跳过
    • git config --global user.name myusername
    • git config --global user.email myusername@example.com
  4. 抓取文件并将其克隆到新的git repo中

    • git svn fetch
    • git clone . ../myrepository
    • cd ../myrepository
  5. 在gitlab中设置新的存储库,确保您的用户可以访问它。

  6. 添加一个远程gitlab存储库

    • git remote add gitlab gitlab.example.com:gitlab-group/myrepository.git
    • 也可以使用gitlib提示信息操作
    • Git 全局设置
      git config --global user.name "bo wang"
      git config --global user.email "wb2110@qq.com"
      
      创建一个新仓库
      git clone http://gitlab.xxx.com/web-ui.git
      cd web-ui
      touch README.md
      git add README.md
      git commit -m "add README"
      git push -u origin master
      推送现有文件夹
      cd existing_folder
      git init
      git remote add origin http://gitlab.xxx.com/web-ui.git
      git add .
      git commit -m "Initial commit"
      git push -u origin master
      推送现有的 Git 仓库
      cd existing_repo
      git remote rename origin old-origin
      git remote add origin http://gitlab.xxx.com/web-ui.git
      git push -u origin --all
      git push -u origin --tags
  7. 仔细检查您的配置myrepository/.git/config(尤其是URL行)

    [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = /root/temp/. fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = gitlab merge = refs/heads/master [remote "gitlab"] url = http://gitlab.example.com/gitlab-group/myrepository.git fetch = +refs/heads/*:refs/remotes/gitlab/* [user] name = myusername

  8. 将其全部推向上游

    • git push --set-upstream gitlab master

搬运from:https://stackoverflow.com/questions/35900710/svn-to-git-conversion-correct-remote-ref-must-start-with-refs-error

标签:svn,origin,git,--,gitlab,com,前移
来源: https://www.cnblogs.com/wolbo/p/14810264.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有