Git - 推送无法执行

时间:2014-08-16 14:38:37

标签: git repository git-push atlassian-sourcetree

我不是Git新手。我下载了SourceTree for Windows并尝试使用Git。

我已经创建了Git存储库。然后我克隆了这个存储库。然后我在克隆的存储库中创建了文件并提交它。现在我想将更改推送到主存储库并遇到问题。

当我在克隆的存储库中为master分支选择push to origin时,我收到以下消息:

remote: error: refusing to update checked out branch: refs/heads/master[K
remote: error: By default, updating the current branch in a non-bare repository[K
remote: error: is denied, because it will make the index and work tree inconsistent[K
remote: error: with what you pushed, and will require 'git reset --hard' to match[K

remote: error: the work tree to HEAD.[K
remote: error: [K
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to[K
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into[K
remote: error: its current branch; however, this is not recommended unless you[K

remote: error: arranged to update its work tree to match what you pushed in some[K
remote: error: other way.[K

remote: error: [K

remote: error: To squelch this message and still keep the default behaviour, set[K

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.[K
To D:\DaneAplikacji\GIT Repos\katalog

 ! [remote rejected] master -> master (branch is currently checked out)

error: failed to push some refs to 'D:\DaneAplikacji\GIT Repos\katalog'

我想我做错了什么。如何将这些更改推送到主存储库?

1 个答案:

答案 0 :(得分:0)

我尝试使用TortoiseGit做同样的事情,效果是一样的。在将主存储库作为裸存储库后,我现在可以将更改推送到此主存储库