使用git GUI在COMMIT之后无法推送

时间:2017-05-29 11:27:13

标签: git bash visual-studio version-control

我想使用dropbox文件夹存储GIT原始仓库(Visual Studio解决方案)。所以我使用git GUI在我的文件夹中创建了一个新的repo,然后我在其中移动了我的项目源并在Visual Studio Project文件夹中的两台机器上克隆了这个repo。我能够从VS和GIT bash / GUI提交更改,但是我无法将这些更改推送到dropbox中的原点,这是来自git GUI的错误:

Pushing to C:/Users/noomak/Dropbox/git/repo/project1
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: is denied, because it will make the index and work tree inconsistent        
remote: with what you pushed, and will require 'git reset --hard' to match        
remote: the work tree to HEAD.        
remote: 
remote: You can set the 'receive.denyCurrentBranch' configuration variable        
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into        
remote: its current branch; however, this is not recommended unless you        
remote: arranged to update its work tree to match what you pushed in some        
remote: other way.        
remote: 
remote: To squelch this message and still keep the default behaviour, set        
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.        
To C:/Users/noomak/Dropbox/git/repo/project1
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'C:/Users/noomak/Dropbox/git/repo/project1'`

1 个答案:

答案 0 :(得分:1)

正如错误所示,您通常不应该推送到非裸存储库,如果没有额外的操作,您也无法进入当前已检出的分支。你应该制作你的"遥控器"使用--bare上的git init将存储库作为裸存储库。