2015-12-09 84 views
1

大家好,感谢您提前查看本文并尝试提供帮助。Git with Cpanel - 无法推送

我想通过SSH在(namecheap)共享服务器上使用git与cpanel。 虽然我能克隆/拉(如果我上传文件并提交它们),但它不允许我从本地推送到远程回购。

我有以下错误:

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'. 

我试图本地创建一个新的分支,以不推主站远程主为在这里的一些答案解释,对SO。也试过git init --bare,似乎也没有工作。

任何帮助非常感谢,因为我失去了最后5个小时试图解决这个问题。谢谢。

回答

0

Git通常有两种存储库,包括工作空间和缺少工作空间的存储库。后者是一个“裸露”的存储库,当它跟踪文件,合并,分支和其他项目时,它不被用作代码签出的接收者,不用作编辑文件的地方,也不用作地方将文件推送到远程。

看来您正在使用的git存储库是非裸存储库,并且您正试图从远程进行更新。如果那是这种情况,那么你的“主人”本地分支已经有了一段历史。您需要将远程历史合并到您的。