2

我正在使用 SmartGit,我正在尝试将我的最新提交推送到一个裸存储库,该存储库在 /media/webserver/git/projectname 处绝对是裸存储,但我不断收到以下输出,有没有人知道出了什么问题?

谢谢

Push: Not all refs have been pushed.
'master' rejected (non-fast-forward)
Counting objects: 1   
Counting objects: 29, done.
Delta compression using up to 2 threads.
Total 15 (delta 11), reused 0 (delta 0)
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'.        
error: failed to push some refs to '/media/webserver/git/projectname'

下面显示了我之前尝试 Commit & Push 的输出,然后我尝试 pull(rebase) 最新的更改,然后再进行一次推送,从而产生上述输出。

Commit: Not all refs have been pushed.
[master e465187] * My commit message here
 6 files changed, 580 insertions(+), 325 deletions(-)
 rewrite controllers/courses/views/course_apply.php (98%)
 rewrite controllers/mail/cont_mail.php (96%)
'master' rejected (non-fast-forward)
error: failed to push some refs to '/media/webserver/git/projectname'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
4

1 回答 1

1

回答您不会立即在副本中看到的内容

看起来您想通过使用已签出的工作副本推送到 repo 来部署您的网站,这是一个坏主意,尤其是因为它会产生这种错误。

您应该使用更新后挂钩和裸存储库,如此处所述

于 2013-07-30T16:42:47.410 回答