2012-08-08 144 views
1

首先抱歉,但我沒有搜索到任何幫助我的東西。Git共享存儲庫不能作爲'共享'

我已經在我的工作創造了測試服務器一個Git倉庫,像這樣:

cd home/REPO 
git init 

然後我在本地機器克隆(空):

cd /home/workingFolder 
git clone ssh://[email protected]:port/home/REPO 

樣樣精。 然後我複製已經存在,然後一些文件(.DOC):

git add . 

和COMMITED並推送到服務器REPO

git commit 
git push 

我的朋友的話,克隆回購爲他的機器,並得到文件。

現在我包括另一個文件,添加的git,COMMITED並沒有問題推。

當我的朋友試圖拉取或不發生任何事情。

也許我不明白Git是如何想工作,但我怎麼能分享我的同事之間的文件嗎? 這是在REPO服務器

[core] 
    repositoryformatversion = 0 
    filemode = true 
    bare = true 
    logallrefupdates = true 
    sharedRepository = true 
[push] 
    default = current 
+0

更有趣的是你的.git/config。你可以發佈嗎?你的同事如何克隆回購? – fork0 2012-08-08 20:35:57

+0

您是否添加/修改了「bare」和「sharedRepository」值? – 2012-08-08 20:36:07

回答

0

也許我不明白Git是如何想的工作...

這是問題。

解決了創建中央存儲庫爲--bare的問題。裸露的意思是這個存儲庫不包含項目的任何實際文件,只包含關於快照的信息。

1

個人而言,我只想嘗試使用GitHub上的配置文件。在這種情況下,我會做到這一點:

$ mkdir my_git_test 
$ cd my_git_test/ 
$ do the github stuff 

Create the repository in github on the github site (free). 
Then use the 'copy' link/button 

Then, in a terminal do: 
$ git clone [paste], e.g. git clone https://github.com/durrantm/my_git_test.git 

$ cd my_git_test 

$ touch aaa # as a test 
(or move your existing files into the `my_git_test` directory) 

$ git status # Make sure there are changes showing 

$ git add . # Add your changes to your repository. 

$ git commit -m "One Change" 

$ git push origin master 

Your friend can then do: 
(github) Use the 'copy' link/button 
Then, in a terminal locally, do 
$ git clone [paste], e.g. git clone https://github.com/durrantm/my_git_test.git 

展望未來,使後(本地)改變了你應遵循的程序:

  • 使局部的變化。
  • git pull origin master(看看是否有任何改變)
  • 解決任何衝突(如果有任何衝突,你會看到適當的消息)。
  • git push origin master(把你的變化)

你或許可以適應這個沒有GitHub的工作,如果你真的不得不這樣做。

+0

github.com很棒。但在工作情況下,如果要保持資料庫的私密性,則必須升級到付費帳戶。我還會檢查是否可以將專有代碼導出到第三方服務器。有些公司不喜歡那樣。 – 2012-08-08 20:51:09

+0

權限問題。我改變了REPO小組,現在工作正常。無論如何,感謝您的幫助。 – user1585759 2012-08-09 14:13:11