2010-04-30 49 views
1

我有一臺服務器(通過ssh)在互聯網上,我的朋友和我一起使用的項目。我們已經開始使用git進行源代碼管理。我們的設置目前如下:github像私人服務器上的工作流程ssh

  • 朋友創建存儲庫上servergit --bare init命名project.friend.git
  • 我使用git clone [email protected]:/git_repos/project.jesse.git
  • server克隆project.friend.gitproject.jesse.git
  • 然後我就server克隆project.jesse.git到我的本地機器我在本地機器上工作並提交給本地機器。當我想將我的更改推送到時,我使用git push origin master。我的朋友正在研究project.friend.git。當我想要得到他的改變時,我做了pull [email protected]:/git_repos/project.friend.git

似乎一切都做工精細,不過,我現在得到以下錯誤,當我做git push origin master

localpc:project.jesse jesse$ git push origin master 
Counting objects: 100, done. 
Delta compression using up to 2 threads. 
Compressing objects: 100% (76/76), done. 
Writing objects: 100% (76/76), 15.98 KiB, done. 
Total 76 (delta 50), reused 0 (delta 0) 
warning: updating the current branch 
warning: Updating the currently checked out branch may cause confusion, 
warning: as the index and work tree do not reflect changes that are in HEAD. 
warning: As a result, you may see the changes you just pushed into it 
warning: reverted when you run 'git diff' over there, and you may want 
warning: to run 'git reset --hard' before starting to work to recover. 
warning: 
warning: You can set 'receive.denyCurrentBranch' configuration variable to 
warning: 'refuse' in the remote repository to forbid pushing into its 
warning: current branch. 
warning: To allow pushing into the current branch, you can set it to 'ignore'; 
warning: but this is not recommended unless you arranged to update its work 
warning: tree to match what you pushed in some other way. 
warning: 
warning: To squelch this message, you can set it to 'warn'. 
warning: 
warning: Note that the default will change in a future version of git 
warning: to refuse updating the current branch unless you have the 
warning: configuration variable set to either 'ignore' or 'warn'. 
To [email protected]:/git_repos/project.jesse.git 
    c455cb7..e9ec677 master -> master 

這是警告什麼我需要擔心什麼?就像我說的,一切似乎都在起作用。我的朋友能夠從我的分支中提取我的更改。我有服務器上的克隆,所以他可以訪問它,因爲他無法訪問我的本地計算機。有什麼可以做得更好嗎?

謝謝!

+0

你確定你的'master'指向'project.jesse.git'嗎? – 2010-04-30 03:57:34

+0

@matt b,因爲我發給主人的改變不會出現在project.friend.git中,直到他把他們拉進自己爲止。 – 2010-04-30 04:07:15

回答

4

您應該在服務器上設置一個裸露的存儲庫。裸存儲庫僅包含版本歷史記錄信息,通常位於存儲庫根目錄的.git目錄中。你可以從它克隆或推送到任何其他存儲庫一樣。

裸倉庫與

git init --bare 

創建如果你已經有一定的歷史版本進行裸克隆

git clone --bare git://some/where 

至於你的警告看到this question

+0

我的不好...當我創建第一個倉庫時,我曾經使用過git init --bare。鏈接爲+1。 – 2010-04-30 03:53:32

+0

當我克隆存儲庫時,我一直缺少的是--bare。謝謝! – 2010-04-30 12:59:51

相關問題