Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

! [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

like image 216
user3052178 Avatar asked Jan 14 '14 11:01

user3052178


People also ask

What is remote master in git?

When you clone a repository with git clone , it automatically creates a remote connection called origin pointing back to the cloned repository. This is useful for developers creating a local copy of a central repository, since it provides an easy way to pull upstream changes or publish local commits.

Why is git push being rejected?

A commit gets rejected and causes a failed to push some refs to error because the remote branch contains code that you do not have locally. What this means is that your local git repository is not compatible with the remote origin. Based on the above, your local machine is missing commits C and D.

What is a remote master branch?

origin/master is the remote master branch. Usually after doing a git fetch origin to bring all the changes from the server, you would do a git rebase origin/master , to rebase your changes and move the branch to the latest index.


1 Answers

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

like image 149
VonC Avatar answered Oct 11 '22 03:10

VonC