user3052178
user3052178

Reputation: 63

! [remote rejected] master -> master (branch is currently checked out) Error in git

I am very novice when it comes to GIT. Here I have tried to explain my error scenario. Please help me with exact command.

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 :

  1. ssh://[email protected]/apps/git/web-platform/dotcms/modules/funder-request.git
  2. 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.

But when I do the same for funder-request.git, After running the command 'git push origin master' its throwing the following error:

>$ 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

Upvotes: 6

Views: 22215

Answers (1)

VonC
VonC

Reputation: 1324917

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).

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.

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 ?".

Upvotes: 4

Related Questions