dropbox + git:无法推回原点

时间:2011-10-05 21:35:46

标签: git push dropbox

我在Dropbox文件夹中有一个裸存储库,我在我使用的多台计算机上共享这些存储库。这应该是一个简单的设置,但我似乎无法推翻我的更改。

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

我错过了什么?

1 个答案:

答案 0 :(得分: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