日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

使用subgit进行svn迁移至git(branch,tags)

發布時間:2024/4/13 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用subgit进行svn迁移至git(branch,tags) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前言:

  最近公司需要將整體項目從svn遷移至gitlab上,經過幾天的研究,現記錄一下流程

  整體思路是進行一次導入:

  先通過subgit將svn整個import至本地,在與git上的項目進行合并.

1.硬件環境

  git:git version 2.7.4
  svn: 1.6.11

? ? subgit:3.2.2
2.下載subgit

  官網下載subgit: https://subgit.com/

  將subgit解壓:    

tar -zcvf subgit-3.2.2.zip

3.在gitlab上新建一個需要合并的項目

  進入gitlab管理界面,新建項目:lclctest  

git@xx.xx.xx.xx:lclc/lclctest.git (我這邊新建了一個lclc的組)

  建好以備用.

?4.進入subgit-3.2.2/bin 目錄,使用configure命令  

./subgit configure http://ip:port/svn/lclctest lclctest

完成后會有一些提示:  

1) Adjust Subversion to Git branches mapping if necessary:/root/lclctmp/tmp/subgit-3.2.2/bin/lclctest/subgit/config 2) Define at least one Subversion credentials in default SubGit passwd file at:/root/lclctmp/tmp/subgit-3.2.2/bin/lclctest/subgit/passwdOR configure SSH or SSL credentials in the [auth] section of:/root/lclctmp/tmp/subgit-3.2.2/bin/lclctest/subgit/config 3) Optionally, add custom authors mapping to the authors.txt file(s) at:/root/lclctmp/tmp/subgit-3.2.2/bin/lclctest/subgit/authors.txt 4) Run SubGit 'install' command:subgit install lclctest

意思是進行一些配置,然后進行install

  配置config:由于3.2.2默認是配置好的,可以不進行配置  

trunk = trunk:refs/heads/master branches = branches/*:refs/heads/* branches = branches/features/*:refs/heads/features/* branches = hotfixes/*:refs/heads/hotfixes/* tags = tags/*:refs/tags/* shelves = shelves/*:refs/shelves/*

  配置用戶映射文件 author.txt 格式為:svnUser = Git User <user@example.com> (也可以不修改)
5.進行install

$ ./subgit install lclctest

  此步將連接svn,需要耗時一段時間.

  完成后就把svn代碼遷移到本地庫了,這時候就需要用git push到遠程庫中

6.clone版本  

git clone ./lclctest lclctest.git

7.進入lclctest.git目錄  

git remote set-url origin git@yourip:lclc/lclctest.git(之前創建的git項目) git push origin master

  在push的時候發現提示填寫密碼:  

 git@ip's password:

  此時說明需要進行身份驗證,我們給git添加一個keygen就行了

  7.1:生成keygen 

cd ~ ssh-keygen -t rsa -C "your_email@example.com"

  生成的文件在 .ssh文件下有 id_rsa和id_rsa.pub文件

  7.2:上傳keygen

  打開gitlab的管理界面

  

?

? 將id_rsa.pub文件中的內容復制到Key的文本框里.

再執行步驟7的git push origin master命令上傳master

8.上傳分支.

  進入lclctest.git目錄,使用命令查看分支  

git branch -a

結果:

* masterremotes/origin/HEAD -> origin/masterremotes/origin/bugfixremotes/origin/developremotes/origin/featureremotes/origin/master

本項目一共有3個分支,分別是bugfix,develop,feature,分別進行上傳

git push origin remotes/origin/feature:refs/heads/feature git push origin remotes/origin/bugfix:refs/heads/bugfix git push origin remotes/origin/develop:refs/heads/develop

注意:冒號后面為遠程庫中的地址,必須以refs/heads開頭.

9.上傳tags

git push --tags

?

?參考資料:

  http://lattecake.com/post/20051

  http://stackoverflow.com/questions/23251394/subgit-import-and-multiple-branches-directories

?

轉載于:https://www.cnblogs.com/lic309/p/6290597.html

總結

以上是生活随笔為你收集整理的使用subgit进行svn迁移至git(branch,tags)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。