dropbox+git:无法推回到原点
我在 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
我缺少什么?
I have a bare repository in a Dropbox folder which I share across multiple computers I use. This should be a simple setup but I can't seem to push back my changes.
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/'
I tried to pull, but it does nothing.
$ git pull
Already up-to-date.
Branches sample:
$ git branch -a
asdf
* master
remotes/origin/HEAD -> origin/master
Status:
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
nothing to commit (working directory clean)
The config:
$ 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
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试实际阅读 Git 给您的错误消息:
一般来说,您通常只想推送到裸存储库。您的 dropbox 存储库实际上并不是一个裸存储库,因为它有一个已签出的分支。
检查
/path/to/project.git/config
并查看其中的配置。如果是裸露的,则应该有bare = true
。Try actually reading the error messages Git gives you:
In general, you usually only want to push to bare repositories. It appears that your dropbox repository is not actually a bare repository, because it has a checked-out branch.
Check
/path/to/project.git/config
and see what the configuration is there. If it's bare, it should havebare = true
.