[英]Import into github from gitorious?
有沒有人試過或想出如何將一個有價值的回購導入github? 我已經使用github了,想知道是否有辦法從一個我想跟隨github的gitorful repo中拉出來。
這與在Github上創建存儲庫的常規方法有何不同?
Github一開始並不關心存儲庫的來源,只是接受你推送它的任何東西。
在GitHub上創建新存儲庫后,該網站立即為您提供3個優雅的個性化指令集。 3種不同的選擇是:
如果我的用戶名是user1並且新的repo被稱為project1 ,那么它就是這樣說的:
cd existing_git_repo
git remote add origin git@github.com:user1/project1.git
git push -u origin master
已經給出的答案只會導入master - 如果要導入整個repo,包括所有分支,標簽等,則需要執行以下操作:
使用--bare標志克隆gitorious repo - 這會保留所有分支/標簽,並且不會創建工作副本:
$ git clone --bare git://gitorious.org/USER/REPO.git
將目錄更改為本地存儲庫:
$ cd therepo.git
使用--mirror標志將repo推送到github - 這將復制所有分支,標簽,歷史記錄等:
$ git push --mirror git@github.com:USER/REPO.git
刪除本地副本 - 您不再需要它,它對任何東西都沒有多大用處
$ cd .. && rm -rf therepo.git
完成后,您可以使用上面給出的git remote rm/add
命令切換任何本地存儲庫。
以前的答案是正確的,但這是一步一步的過程,包括將本地副本與Gitorious脫鈎的缺失步驟; 沒有它,你會得到fatal: remote origin already exists
的錯誤fatal: remote origin already exists
當你嘗試將Github添加為新的原點時, fatal: remote origin already exists
。
命令:
git clone git://gitorious.org/USER/REPO.git
cd REPO
git remote rm origin
git remote add origin https://github.com/USER/REPO.git
git push --mirror https://github.com/USER/REPO.git
您顯然需要替換USER和REPO,並在創建Github倉庫后在步驟1之后為您提供最后兩個命令。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.