收录日期:2021/01/22 02:39:07 时间:2010-04-01 08:12:04 标签:git,ssh

I'm using Git with TortoiseGit on Windows XP, and I have a remote bare repository on Windows Vista 64bit version.

When I tried to push my local files to remote bare repository, I got the following error message.

git.exe push    "origin" master:master

git: '/Git_Repository/.git' is not a git command. See 'git --help'.

fatal: The remote end hung up unexpectedly

the arbitrary URL is : username@serverip:/Git_Repository/.git

The same arbitrary URL worked just fine while doing clone/fetch/pull.

Access from a local directory in remote machine to this bare repository has no problem either so I belive there is something wrong with my path.

I can push/pull at GitHub correctly but I was using URL provide by GitHub.

Does anyone know what's wrong with my configuration?

Here is my remote .git/config

[core]
repositoryformatversion = 0
filemode = false
bare = true
logallrefupdates = true
ignorecase = true
hideDotFiles = dotGitOnly

Here is my local .git/config

[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
fetch = +refs/heads
url = username@serverip:/Git_Repository/.git
[branch "master"]
remote = origin
merge = refs/heads/master

I edited the URL to make it more precise,but it still show the same error

Even more, no matter what I type after the serverip, it still shows the same error message

if the URL is

ssh://user@server ip/Git_Repositorywrongname/.git

then the error message

git: '/Git_Repositorywrongname/.git' is not a git command. See 'git --help'.

When user connects to the remote repository, the executed git commands are from bin directories in SSH. So I believe therer is wrong with my SSH configuration and this is why I can do git operations normally in local/ local in the remote machine.

I followed the guide in http://code.google.com/p/tortoisegit/wiki/HOWTO_CentralServerWindowsXP and linked the 4 commands

Did I miss anything?

Thanks for your reading

Solved!

Run this command locally:

git config --global remote.origin.receivepack "git receive-pack"

and then inside the local repo just run

git push origin master

Alternately you can append the recieveoack command to every push

git push --receive-pack='git receive-pack'

Try specifying the protocol explicitly (here ssh), avoiding using the ':' between the user@host part, and the local path (look at the urls described in the git fetch man page):

url = ssh://username@serverip/C:/Git_Repository/.git

In other words, avoid the scp syntax for this kind of path.

what about

git push file:///\\<machine-ip>/<share-remote-repo>/