2013-01-08 45 views
1

正如我所創建的共享文件夾的回購與路徑:// WEB1/WWW 在另一臺電腦,我創建了一個文件夾,打開bash的,我所做的:爲什麼我不能推新克隆的回購?

$ git clone //web1/www 
在新創建的文件夾回購然後

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

我加了一個文件,然後:

$ git add . 
$ git commit -m 'new file added' 
$ git push origin master 

但是,這裏是我得到的錯誤如下,任何想法,我應該怎麼辦現在?

$ git push origen master 
fatal: 'origen' does not appear to be a git repository 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists. 

[email protected] /d/ketab projects/www (master) 
$ git remote -v 
origin //web1/www (fetch) 
origin //web1/www (push) 

[email protected] /d/ketab projects/www (master) 
$ git push origin master 
Counting objects: 3, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (2/2), done. 
Writing objects: 100% (2/2), 257 bytes, done. 
Total 2 (delta 1), reused 0 (delta 0) 
remote: error: refusing to update checked out branch: refs/heads/master 
remote: error: By default, updating the current branch in a non-bare repository 
remote: error: is denied, because it will make the index and work tree inconsist 
ent 
remote: error: with what you pushed, and will require 'git reset --hard' to matc 
h 
remote: error: the work tree to HEAD. 
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to 

remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into 

remote: error: its current branch; however, this is not recommended unless you 
remote: error: arranged to update its work tree to match what you pushed in some 

remote: error: other way. 
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, set 

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. 

PS:我在Windows 7上的本地網絡,使用域不是一個工作組

+2

從錯誤它看起來像遠程git回購@「//web1/www在另一臺PC」是一個**非裸**混帳。推到這個遠程非裸回購將導致不一致,除非你做'git reset --hard HEAD' @遠程回購(如錯誤消息中所述)。請看看[這些](http://stackoverflow.com/questions/1764380/push-to-non-bare-repository)[posts](http://stackoverflow.com/questions/12265729/git-config -receive-denycurrentbranch) –

+1

來詳細說明上述情況,如果遠程是一箇中央存儲,它應該是一個裸倉庫。但是,如果您必須推送到非裸存儲庫(例如將更改發送給同事),最好推送到新的(臨時)分支並在遠程存儲庫上合併。更好的辦法是建立一個新的本地分支機構,並讓同事撤回變更,避免推向非裸倉庫。 –

回答

1

這是因爲你的來源是一個完整的存儲庫。

,如果你想推到它需要裸一個回購協議(沒有工作樹)創造了回購使用--bare標誌

git init --bare

推命令時

只更新內部的git文件,而不是工作目錄。所以從本質上講,如果你推到一個完整的repo,HEAD(工作目錄中的簽出文件)實際上將落後於你剛剛推出的流血邊緣提交。所以git開發者決定不允許這樣做。

0

混帳推奧利主

它的起源

git push origin master 
+0

你沒有回答整個問題 –