Making Git work on the server:
If not already done, install msysgit on your server (I would recommend to install it directly to C:\Git or at least a path that has no spaces because I had some weird issues with 「spaced」 paths)
Add C:\Git\bin to the PATH variable. This is very important!! sh.exe and other dependencies are in this folder
Now go to C:\Git\bin and add the following two files
gup.sh grp.sh 4. Open gup.sh in your favorite editor and insert
C:/Git/libexec/git-core/git-upload-pack.exe $*
5. Open grp.sh and insert
C:/Git/libexec/git-core/git-receive-pack.exe $* The $* essentially rips off the single quotes from the repository path argument, so a path that has spaces in it won’t work here either I guess
Basically we’re done now and all git operations from the client should work. For a clone you have to type
git clone -u 'sh gup.sh' ssh://[email protected]/path/to/myrepo.git
or a push would be
git push --exec 'sh grp.sh' ssh://[email protected]/path/to/myrepo.git
but that is not very elegant.
Cleaning things up:
- At first we want to get rid of the whole repo path by specifying a remote alias
git remote add origin ssh://[email protected]/path/to/myrepo.git Where 「origin」 would be the alias name
- Next we set the config for the git-upload-pack and git-receive-pack so we don’t have to reference the shell script all the time.
git config remote.origin.uploadpack 'sh gup.sh'
and
git config remote.origin.receivepack 'sh grp.sh'
That’s it. Now we can use the normal git commands without any additional parameters:
git clone origin git push origin master git pull origin ...
也許這樣? HTTP://計算器。com/questions/8170436/git-remote-error-fatal-protocol-error-bad-line-length-character-unab – ellotheth 2012-05-23 19:01:28