【问题标题】:! [remote rejected] master -> master (branch is currently checked out) Error in git! [远程拒绝] master -> master(当前已签出分支)git中的错误
【发布时间】:2014-01-14 20:17:43
【问题描述】:

我对 GIT 非常陌生。在这里,我试图解释我的错误场景。请帮我准确的命令。

我必须清空 GIT 远程位置的存储库。而且我只有权限克隆它们并将我的更改推送给它们。我无权直接访问 GIT Remote。 回购是。资助者-调度器.git 和资助者-请求.git。 他们的详细路径:

  1. ssh://gitadmin@svn.wps.wiley.com/apps/git/web-platform/dotcms/modules/funder-request.git
  2. ssh://gitadmin@svn.wps.wiley.com/apps/git/web-platform/dotcms/modules/funder-scheduler.git

现在我在本地克隆了funder-scheduler.git。我添加了我的更改。然后我做了一个 GIT 提交。 然后 git push origin master。 效果很好。

但是当我对funder-request.git做同样的事情时,在运行命令'git push origin master'之后它会抛出以下错误:

>$ git push origin master
>Enter passphrase for key '/u/.ssh/id_rsa':
>Counting objects: 81, done.
>Compressing objects: 100% (61/61), done.
>Writing objects: 100% (81/81), 215.86 KiB | 126.00 KiB/s, done.
>Total 81 (delta 4), 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 inconsist
ent
>remote: error: with what you pushed, and will require 'git reset --hard' to matc
h
>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'.
To ssh://gitadmin@svn.wps.wiley.com/apps/git/web-platform/dotcms/modules/funder-
request.git
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://gitadmin@svn.wps.wiley.com/apps/git/we
b-platform/dotcms/modules/funder-request.git'

请求用确切的命令帮助我解决这个问题。 我不会理解理论解释,对此我很抱歉

【问题讨论】:

    标签: git version-control github ssh


    【解决方案1】:

    看起来funder-request.git 不是一个裸仓库,这意味着它有一个工作树(来自分支结帐的文件)。

    请参阅“all about "bare" repos -- what, why, and how to fix a non-bare push”了解更多信息:
    使用 non-bare repo 存在使工作树的内容与 git repo 本身的内容不同步的风险。

    您需要联系该服务器的管理员并将其转换为裸仓库。
    见“How to convert a git repository from normal to bare ?”。

    【讨论】:

      猜你喜欢
      • 2015-09-26
      • 2016-07-24
      • 1970-01-01
      • 2012-02-17
      • 2019-10-16
      • 1970-01-01
      • 2011-02-15
      • 2012-07-25
      相关资源
      最近更新 更多