繁体   English   中英

带有Cpanel的Git-无法推送

[英]Git with Cpanel - can't push

大家好,并感谢您对此内容的浏览和提供的帮助。

我正在尝试通过SSH与(namecheap)共享服务器上的cpanel一起使用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.
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'.

我尝试在本地创建一个新分支,以免将主服务器推送到远程主服务器,如此处的某些答案所述。 还尝试git init --bare ,似乎也不起作用。

非常感谢您提供的任何帮助,因为我在过去5个小时内都没有设法解决此问题。 谢谢。

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

似乎您正在使用的git存储库是一个非裸露的存储库,并且您正在尝试从远程进行更新。 如果是这种情况,则您的“ master”本地分支已经具有历史记录。 您需要将远程历史记录合并到您的历史记录中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM