2012-02-11 110 views
0

我想在遠程git服務上使用回購作爲本地創建回購的備份。遠程服務即Bitbucket,但問題可以適用於其他人。從本地回購備份到遠程服務(如Bitbucket)

我無法在Bitbucket上創建裸回購(或者我可以嗎?),所以我不知道如何使用'push --mirror'。

推進各分公司,並承諾是那種美好的,但我們要推的更越好,如: 標籤,遠程三分球,遠程分支機構 - 所以,如果我們克隆回來下游,我們得到了一個克隆即已經足夠接近原始的本地回購,而不需要太多的重新佈線。

我們不關心未提交的工作或工作目錄或暫存區域。工作流程將執行提交,然後推送到備份。

我們不是在尋求一個涵蓋工作和臨時區域的完美克隆。此外,我們並不尋求防彈備份,我明白分支機構可以在本地刪除,並在遠程丟失。所以基本上這是一個簡單的方法來對已經存在的服務進行部分備份,並提供免費的私人帳戶 - 其中 提供了一定程度的冗餘,因此提供了一些思路。

我該如何實現上述目標。

首先編輯:

這是第一次試驗的日誌 - 不是我想從我的所有本地測試預期,但是這就是我得到:

  • 上創建回購到位桶:
https://[email protected]/shishani/test1.git 
  • 本地會話
$ git remote add bbtest1 https://[email protected]/shishani/test1.git 

$ git status 
# On branch master 
nothing to commit (working directory clean) 

$ git branch -a 
* master 
    remotes/origin/HEAD -> origin/master 
    remotes/origin/master 

$ git remote -v 
bbtest1 https://[email protected]/shishani/test1.git (fetch) 
bbtest1 https://[email protected]/shishani/test1.git (push) 
origin /more/coding/git-tests/test-orig (fetch) 
origin /more/coding/git-tests/test-orig (push) 


$ git push --mirror bbtest1 
Password: 
fatal: remote part of refspec is not a valid name in :capabilities^{} 
fatal: The remote end hung up unexpectedly 

任何想法是怎麼回事?!

第二個編輯:

我分叉了意外的錯誤消息在這裏另外一個問題: fatal: remote part of refspec is not a valid name in :capabilities^{}

回答

1

我沒有用到位桶,但這一過程將與上述任何或多或少相當於託管提供商:

創建遠程存儲庫。(如:test

添加它作爲一個遙控器來的git:

# these paths should be accurate, but check your repo provider 
git add remote bitbucket https://[email protected]/you/test.git 
git add remote github [email protected]:you/test.git 

推到它:

git push bitbucket --mirror 
git push github --mirror 
+0

謝謝,請檢查我的編輯 - 我打算重現我的所有本地測試,但是我用Bitbucket獲得了一些新的意想不到的東西。 – 2012-02-12 02:36:41

+0

我懷疑本地裁判有一個名稱,遠程不接受,但我不知道爲什麼。但是,本地存儲庫中有些奇怪,因爲您遵循的步驟應該已經工作。我會建議依次推送每個裁判,找出哪一個不好。 – 2012-02-12 02:46:41