You are watching: [remote rejected] master -> master (pre-receive hook declined)
I am currently able to properly clone a Git repository native my resource (192.168.1.2) come my destination (192.168.1.1).
But when I did an modify to a file, a git commit -a -m "test" and a git push, I obtain this error on my location (192.168.1.1):
git push hap
192.168.1.2"s password: count objects: 21, done.Compressing objects: 100% (11/11), done.Writing objects: 100% (11/11), 1010 bytes, done.Total 11 (delta 9), reused 0 (delta 0)error: refusing to upgrade checked out branch: refs/heads/mastererror: by default, update the present branch in a non-bare repositoryerror: is denied, due to the fact that it will make the index and also work tree inconsistenterror: v what friend pushed, and will call for "git reset --hard" come matcherror: the work-related tree to HEAD.error: error: girlfriend can set "receive.denyCurrentBranch" configuration variable toerror: "ignore" or "warn" in the remote repository to enable pushing intoerror: its current branch; however, this is no recommended unless youerror: arranged to upgrade its work tree to complement what you pushed in someerror: other way.error: error: to squelch this message and still keep the default behaviour, seterror: "receive.denyCurrentBranch" configuration variable come "refuse".To git+ssh://hap
192.168.1.2/media/LINUXDATA/working"I"m utilizing two different versions of Git (1.7 on the remote and also 1.5 on the neighborhood machine). Is the a feasible reason?
improve this inquiry
edited might 23 "17 at 10:31
111 silver badge
asked may 12 "10 at 6:06
133k4242 gold badges7878 silver- badges9191 bronze badges
| present 2 more comments
31 answers 31
energetic oldest Votes
You can simply transform your far repository to bare repository (there is no working copy in the bare repository - the folder contains only the really repository data).
Execute the complying with command in your remote repository folder:
git config --bool core.bare trueThen delete all the documents except .git in the folder. And then friend will be able to perform git push to the far repository without any kind of errors.
boost this answer
edited Feb 12 "13 in ~ 21:45
28.9k2121 yellow badges9595 silver- badges123123 bronze title
answered Jul 14 "10 at 22:45
12k11 gold badge1313 silver- badges55 bronze title
| show 16 much more comments
I just had actually the very same error if I started learning Git. Some of the various other answers are plainly not for someone brand-new to Git!
(I am going to use non technological terms to obtain the idea across.) Anyway, what is keep going is that you have two repositories, one is the initial you very first made, and also the other the job-related one you just made.
Right now you room in your work repository and also are using the "master" branch. Yet you additionally happen to be "logged in" in your initial repository come the very same "master" branch. Now since you"re "logged in" in the original, Git fear you might mess up because you might be functioning on the original and also screw points up. So you must return to the original repository and do a "git checkout someotherbranch", and also now you have the right to push v no problems.
I expect this helps.
boost this prize
edited Feb 12 "13 at 21:44
28.9k2121 yellow badges9595 silver- badges123123 bronze badges
answered may 29 "10 at 3:26
Robert GouldRobert Gould
66k5858 yellow badges178178 silver- badges269269 bronze badges
| display 11 more comments
The error message defines what has happened. More contemporary versions that Git refuse to update a branch via a press if the branch is confirm out.
The easiest method to work in between two non-bare repositories is one of two people to
always upgrade the repositories by pull (or fetch and also merge) or, if you have actually to,
by pushing to a separate branch (an import branch) and also then merging the branch into the understand branch on the remote machine.
The factor for this border is the the push procedure operates only on the remote Git repository, the doesn"t have access to the index and working tree. So, if allowed, a push on the checked-out branch would adjust the HEAD to be inconsistent with the index and also working tree on the remote repository.
See more: What Percent Of 84 Is 12 Is What Percent Of 84? = 14 12 Out Of 84 Is What Percent
This would certainly make it an extremely easy to accidentally commit a change that undoes all of the moved changes and additionally makes that very complicated to distinguish between any local transforms that have not been committed and differences between the new HEAD, the index and also the functioning tree that have been brought about by push moving HEAD.