git ![远程拒绝] master -> master(分支当前已检出)git中的错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21112937/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
! [remote rejected] master -> master (branch is currently checked out) Error in git
提问by user3052178
I am very novice when it comes to GIT. Here I have tried to explain my error scenario. Please help me with exact command.
说到 GIT,我是个新手。在这里,我试图解释我的错误场景。请帮我提供确切的命令。
I have to empty repository in GIT remote location. And I only have permission to clone them and Push my changes to them. I don't have any permission to direct access at GIT Remote. The repos are. funder-sceduler.git and funder-request.git. Detailed Path for them :
我必须清空 GIT 远程位置的存储库。我只有克隆它们并将我的更改推送给它们的权限。我没有任何权限直接访问 GIT Remote。回购是。funder-sceduler.git 和 funder-request.git。他们的详细路径:
- ssh://[email protected]/apps/git/web-platform/dotcms/modules/funder-request.git
- ssh://[email protected]/apps/git/web-platform/dotcms/modules/funder-scheduler.git
- ssh://[email protected]/apps/git/web-platform/dotcms/modules/funder-request.git
- ssh://[email protected]/apps/git/web-platform/dotcms/modules/funder-scheduler.git
Now I cloned funder-scheduler.git in my local. I added my changes. Then I did a GIT commit. Then git push origin master. It worked fine.
现在我在本地克隆了 funder-scheduler.git。我添加了我的更改。然后我做了一个 GIT 提交。然后 git push origin master。它工作得很好。
But when I do the same for funder-request.git, After running the command 'git push origin master' its throwing the following error:
但是当我对 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://[email protected]/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://[email protected]/apps/git/we
b-platform/dotcms/modules/funder-request.git'
Requesting to help me with exact command to solve this. I will not understand theoretical explanation, and I'm sorry for that
请求帮助我提供确切的命令来解决这个问题。我不会理解理论解释,我很抱歉
采纳答案by VonC
It appears funder-request.git
is not a bare repo, meaning it has a working tree (files that come from the checkout of a branch).
它似乎funder-request.git
不是一个裸仓库,这意味着它有一个工作树(来自分支结帐的文件)。
See "all about "bare" repos -- what, why, and how to fix a non-bare push" for more:
Using a non-bare repo entails the risk of making the content of the working tree out of sync with the content of the git repo itself.
请参阅“关于“裸”存储库的所有内容——什么、为什么以及如何修复非裸推送”了解更多信息:
使用非裸存储会带来使工作树的内容与内容不同步的风险git repo 本身。
You need to contact the admin of that server and make it convert to a bare repo.
See "How to convert a git repository from normal to bare ?".
您需要联系该服务器的管理员并将其转换为裸仓库。
请参阅“如何将 git 存储库从普通存储库转换为裸存储库?”。