msysgit / git

msysGit-based Git for Windows 1.x is now superseded by Git for Windows 2.x
http://github.com/git-for-windows/git
Other
1.01k stars 317 forks source link

GIT push fails from Windows Machine to SFTP site mapped by win-sshfs #304

Closed larsgjo closed 9 years ago

larsgjo commented 9 years ago

We have a mapped SFTP site as a bare GIT repository. We were able to create a repository, clone it to the dev machines, and push our initial checkin. Subsequent pushes at a later date have failed with "insufficient permission for adding an object to repository database./objects". Version: git version 1.9.5.msysgit.0.

We mapped to the SFTP site using win-sshfs. We did a "cd /w" to get to our repository location, and then ran "git init --bare mvc-solution". Then we cloned the repository to the developer machine ( git clone mvc-solution.git c:/myDeveloperCodeRepo ) and then changed into the developer directory ( cd c:/myDeveloperCodeRepo ). We dropped the source code into the directory, ran "git add ..." and "git commit -m 'Initial Checkin'". We then ran "git push origin master" without any problem.

Then, one day later, we made changes to the developer machine code (added a directory with some files -- spreadsheets, text files, images). We added the files, commited them, and then tried to run git push origin master. We did not get a successful push. Instead, we got the message above (...insuffiecient permission for adding an object...). In other words, were not able to push the files to the sftp bare repository anymore.

We are able to navigate to the sftp site without a problem. The same sftp account and same developer machine is being used for subsequent git requests, but they fail with a permission problem when we do a git push. It seems like a bug with windows git, not sshfs, correct? Will GIT for windows work over mapped drives?

The whole error message was as follows:

$ git push origin master Counting objects: 21, done. Delta compression using up to 8 threads. Compressing objects: 100% (20/20), done. remote: error: insufficient permission for adding an object to repository database./objects remote: fatal: failed to write object fatal: sha1 file '' write error: Broken pipe error: failed to push some refs to 'w:/mvc-solution.git'

larsgjo commented 9 years ago

It turns out that the broken pipe error was being caused by win-sshfs. In order to get this to work, you can use a different ssh drive mapper, like https://www.eldos.com/sftp-net-drive/. In order to get this to work, I set the timeout to 1 or 2 minutes, and I also MADE SURE TO CHECK THE BOX "Delete existing target before moving". You will get an error couldn't set refs/heads/master if you don't put a check in this box. In any case, mysysgit works great over a Windows mapped drive using the sftp net drive. The full details are on stackoverflow: http://stackoverflow.com/questions/27954238/git-push-fails-from-windows-machine-to-sftp-site-mapped-by-win-sshfs