【问题标题】:Git with Cpanel - can't push带有 Cpanel 的 Git - 无法推送
【发布时间】:2015-12-09 02:08:24
【问题描述】:

大家好,提前感谢您查看此内容并尝试提供帮助。

我正在尝试通过 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'.

我尝试在本地创建一个新分支,以便不将 master 推送到远程 master,如这里的一些答案中所述,关于 SO。也试过git init --bare,好像也没用。

非常感谢任何帮助,因为我在过去 5 个小时里试图解决这个问题。谢谢。

【问题讨论】:

    标签: git cpanel


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2015-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-14
      • 2018-02-12
      • 1970-01-01
      • 1970-01-01
      • 2015-09-04
      相关资源
      最近更新 更多