dropbox+git:无法推回到原点

发布于 2024-12-08 06:21:20 字数 1889 浏览 0 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

§普罗旺斯的薰衣草 2024-12-15 06:21:20

尝试实际阅读 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

Try actually reading the error messages Git gives you:

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. If it's bare, it should have bare = true.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文