【发布时间】: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 个小时里试图解决这个问题。谢谢。
【问题讨论】: