简体   繁体   English

dropbox + git:无法推回原点

[英]dropbox+git: can't push back to origin

I have a bare repository in a Dropbox folder which I share across multiple computers I use. 我在Dropbox文件夹中有一个裸存储库,可以在我使用的多台计算机上共享它。 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? 我想念什么?

Try actually reading the error messages Git gives you: 尝试实际阅读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.

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. 检查/path/to/project.git/config并查看其中的配置。 If it's bare, it should have bare = true . 如果是裸露的,则应该有bare = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM