远程拒绝了推送到主分支,错误消息是“在git中当前检出分支无法推送到主分支”。

6

我在GIT方面非常新手。这里我试图解释我的错误场景。请帮我找到确切的命令。

我需要清空GIT远程位置上的存储库。我只有克隆它们和将更改推送到它们的权限。我没有直接访问GIT Remote的任何权限。 存储库是funder-sceduler.git和funder-request.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'

请帮我提供确切的命令来解决这个问题。 我不理解理论解释,对此感到抱歉。

1个回答

4

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接