Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Master failed to write error while pushing commit

Tags:

git

I have a git repository on a company network drive and had no problem pulling from it. However, i wasn't able to push any commits into it, though I had a few good luck but recently I couldn't get anything in it. The error was:

C:\Program Files\Git\bin\git.exe push "origin" master:master error: Couldn't set refs/heads/master To //software/pdd.git/ ! [remote rejected] master -> master (failed to write) error: failed to push some refs to '//software/pdd.git/' Done

I suspect that it got to with the master file. On Windows, it shows that I might have been put into a network group that does not allow me to do modify but was able to read, write and execute.

My question is: If i was able to push a few times before, this file permission thing shouldm't be a hassle to me. If it, indeed, that I don't have enough privillage to modify, is there a workaround?

PS: The company is reluctant to change my network group to another, which would enable me to modify files.

like image 291
freonix Avatar asked Sep 02 '11 02:09

freonix


People also ask

How do I fix git push failed?

How to Fix the error: failed to push some refs to Error in Git. We can fix the error: failed to push some refs to [remote repo] error in Git using the git pull origin [branch] or git pull --rebase origin [branch] commands. In most cases, the latter fixes the error.

How do I fix git push origin master?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

Which error would you get if you try to push master branch changes to a remote repository?

The error message error: refusing to update checked out branch: refs/heads/master is emitted by the remote repository and it means you're trying to push code to remote non-bare repository that has different code currently checked out in the working directory.

What is the cause of this git error?

A Git command needs to be run on a specific repository, so this error typically occurs when a Git command is run in a directory that Git doesn't know about. In these cases, the fix is to make sure that you are both working in the correct folder and that you set up your repository right.


1 Answers

Check the question "Pushing to a Git repository on an NFS share fails":

The NAS is doing weird things to permissions, setting the sticky bit on all directories. This explains the behavior. An additional chmod solved the problem.

That means this is a permission issue on the target (remote) side, as illustrated in "Git issues after upgrading to osx Lion":

there was an odd permission for everyone as ‘custom’. I updated this to be ‘Read & Write’ and the commit was finally successful.

As a "workaound", See this Error section:

I just deleted my bare repository and created a brand new one and pushed my changes over there. And everything works again.

like image 58
VonC Avatar answered Sep 20 '22 00:09

VonC