Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Google代码上的SVN repo迁移到GitHub上的git repo_Git_Svn_Github - Fatal编程技术网

如何将Google代码上的SVN repo迁移到GitHub上的git repo

如何将Google代码上的SVN repo迁移到GitHub上的git repo,git,svn,github,Git,Svn,Github,我很难从code.google上托管的SVN存储库切换到github上的git repo。具体而言: 如何在保留修订历史记录的同时将code.google上的代码从SVN更改为GIT 如何在保留修订历史记录的同时,将code.google上的wiki从SVN更改为GIT 如何将GIT存储库从code.google移动到GitHub 我如何保持这两个存储库彼此同步,同时仍然使用GitHub作为主要repo 变量: $project是您的项目名称 $username是您在github上的用户名

我很难从code.google上托管的SVN存储库切换到github上的git repo。具体而言:

  • 如何在保留修订历史记录的同时将code.google上的代码从SVN更改为GIT
  • 如何在保留修订历史记录的同时,将code.google上的wiki从SVN更改为GIT
  • 如何将GIT存储库从code.google移动到GitHub
  • 我如何保持这两个存储库彼此同步,同时仍然使用GitHub作为主要repo
  • 变量:

    • $project是您的项目名称
    • $username是您在github上的用户名
    这假设您的$project名称在github上与code.google上相同,并且您已经初始化了github存储库

    此外,如果您的code.google存储库已经是GIT,则可以跳到步骤4

  • 将项目从SVN转换为GIT。这就像进入Administration->Source选项卡并将其从SVN更改为GIT一样简单。顺便说一句,完成此操作后,svn仍然可用;所以,不要担心完全的代码丢失

  • 将source从code.google SVN转换为code.google GIT(保留历史记录)

  • 将wiki从google SVN转换为google GIT(保留历史记录)

  • 从github获取新的git回购

    mkdir github
    cd github/
    git clone https://code.google.com/p/$project.git
    cd $project/
    
  • 从code.google GIT获取源代码到本地github克隆

    git remote set-url origin https://github.com/$username/$project.git
    git pull
    
  • 将源从本地克隆推送到github

    git push origin master
    
  • 告诉本地克隆将提交推送到github和code.google

    git remote set-url --add origin https://$project.googlecode.com/git
    
    touch test.txt
    git add test.txt
    git commit -m "Testing repo replication" test.txt
    git push
    
  • 测试推送提交到github和code.google

    git remote set-url --add origin https://$project.googlecode.com/git
    
    touch test.txt
    git add test.txt
    git commit -m "Testing repo replication" test.txt
    git push
    
  • 现在,无论何时更改本地克隆,它都会将这些更改推送到两个存储库


    注意:如果您在其他位置(如不同的计算机)再次克隆,则必须再次重复步骤6

    现在谷歌代码上有一个导出功能-进入你的项目的谷歌代码页面,即Code.Google.com/p/yourproject,然后你会看到一个按钮“导出到GitHub”,它将分两步完成(注意:你需要用你的GitHub帐户进行授权)

    请注意,您可以为任何项目执行此操作,而不仅仅是您自己的项目