2011-10-05 21 views
0

我在Dropbox文件夾中有一個裸存儲庫,我可以在多臺使用的計算機上共享該存儲庫。這應該是一個簡單的設置,但我似乎無法推回我的更改。dropbox + git:無法推回原點

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 inconsistent 
remote: error: with what you pushed, and will require 'git reset --hard' to match 
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'. 
To /path/to/project.git/ 
! [remote rejected] master -> master (branch is currently checked out) 
error: failed to push some refs to '/path/to/project.git/' 

我試圖拉,但它什麼也沒做。

$ git pull 
Already up-to-date. 

分行樣本:

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

狀態:

$ git status 
# On branch master 
# Your branch is ahead of 'origin/master' by 2 commits. 
# 
nothing to commit (working directory clean) 

的配置:

$ cat .git/config 
[core] 
     repositoryformatversion = 0 
     filemode = true 
     bare = false 
     logallrefupdates = true 
[remote "origin"] 
     fetch = +refs/heads/*:refs/remotes/origin/* 
     url = /path/to/project.git 
[branch "master"] 
     remote = origin 
     merge = refs/heads/master 

我缺少什麼?

回答

3

儘量實際讀取錯誤信息的Git爲您提供:

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 inconsistent 
remote: error: with what you pushed, and will require 'git reset --hard' to match 
remote: error: the work tree to HEAD. 

一般情況下,你通常只需要推到裸庫。看起來您的Dropbox存儲庫實際上不是裸倉庫,因爲它有一個檢出分支。

檢查/path/to/project.git/config看看有什麼配置。如果它是裸露的,它應該有bare = true

+0

這是否意味着我必須簽出另一個分支然後推送?我試過了,但沒有奏效。 我的Google研究告訴我這是關於推入一個非裸倉庫。 – ashraf

+1

不,這意味着您需要在* remote *存儲庫上籤出不同的分支(或者理想情況下,將遠程存儲庫更改爲裸露)。 – Amber

+0

謝謝,現在這是一個啓示。現在我看到我錯了。 以前我在遠程倉庫中發佈了「git status」,並得到了「致命的:這個操作必須在工作樹中運行」,並且假設這意味着倉庫是裸露的,因爲它似乎符合定義。從來沒有四處尋找配置值。我改變了價值,現在它的工作。 現在我只是困惑爲什麼圖形客戶端(EGit,TortoiseGit)在哪裏很酷。 :) – ashraf