2012-12-11 35 views
1

Git-1.7.11-preview20120710.exe由我使用。我創建了一個Git倉庫無法在本地存儲庫上按住git push

cd "GIT scm/" 
git init --bare shahed.git 
cd shahed.git 
git update-server-info 

然後,我通過以下命令啓動Git進程

git daemon --reuseaddr --base-path="E:/GIT scm/" --export-all --verbose --enable=receive-pack 

然後我會克隆Git倉庫如下

git clone git://localhost/shahed.git 

Cloning into 'shahed'... 
warning: You appear to have cloned an empty repository. 

cd shahed 
touch shahed.txt 
touch shohel.txt 
git add *.* 
git commit -m 'ok' 

[master (root-commit) 2062f1d] 'ok' 
0 files changed 
create mode 100644 shahed.txt 
create mode 100644 shohel.txt 

git push 

No refs in common and none specified; doing nothing. 
Perhaps you should specify a branch such as 'master'. 
Everything up-to-date 

雖然下面的消息

Git進程控制檯日誌
[4044] Ready to rumble 
[736] Connection from [::1]:50076 
[736] Extended attributes (16 bytes) exist <host=localhost> 
[736] Request upload-pack for '/shahed.git' 
[4044] [736] Disconnected 
[4860] Connection from [::1]:50079 
[4860] Extended attributes (16 bytes) exist <host=localhost> 
[4860] Request receive-pack for '/shahed.git' 
[4860] fatal: The remote end hung up unexpectedly 

但我無法推動。有人告訴我,我錯過了創建git存儲庫的哪一步。我採取的所有措施都可以,或者缺少配置git存儲庫的地方。

回答

4

這是什麼告訴你,存儲庫中沒有master分支,因爲它被創建爲空。所以,它找不到你想要更新的分支,並且默認情況下它不會盲目地創建一個新的分支(萬一它是一個錯字或其他東西)。您可能需要首次使用git push -f origin master。一旦origin中有master分支,則正常git push應該正常工作。

或者,你可以先創建工作資料庫,至少有一個在它提交,然後git clone --bare到您git-daemon的位置,但你會想刪除origin遠程規範在你裸露的庫,和你」將不得不在你的工作倉庫中手動添加它(或重新克隆)。

+0

我按照您的回答進行了測試,但無法創建主分支庫創建/克隆時間。我用武力選項,但不工作。 'git push -f origin master'需要很長時間,最後我強行終止它。 –

+0

這聽起來更像是你的'git-daemon'配置或防火牆設置的問題。我手動重新創建了你的測試,'git push origin master'肯定爲我工作(但是不合格的'git push'沒有。 – twalberg

+0

防火牆未被阻止。到目前爲止,我可以猜測缺少/未命中配置/某些與路徑設置相關的問題。你能否介紹一下我將從哪裏開始的網頁鏈接? –