问题
I have a problem with with remote git repo and local repo (using SmartGit).
I'm creating remote repo on my server via ssh:
> cd ~
> git init repo.git
> cd repo.git
> touch readme
> git add .
> git commit -m "Initial commit"
From here everything seems perfect. Now I'm trying to clone repo using Smartgit with command
ssh://user@server:22/~/repo.git
Everything is cloning well. I make changes in readme file, saving it and trying to commit and push and getting error:
The remote end hang up unexpectedly
git: '~/repo.git' is not a git command. See 'git --help'
What am I doing wrong? Thank you.
回答1:
Use:
GIT_TRACE=2 git push origin master
and see what is happening to debug the issue.
Update:
It is trying git-receive-pack
Try doing below:
git config --global remote.origin.receivepack "git receive-pack"
And then do the push again.
Other things you can try:
On the remote server setup a bare repo:
git init --bare
And then try cloning and pushing to it.
回答2:
I'd suggest using the full path instead of the home shortcut (~), e.g., git clone ssh://user@server/home/tuergeist/repo
This works for me on linux and also on WindowsXP in a git bash.
You also should obmit the .git
extension, this may confuse your tools, as it expects a bare repository. (But I'm not sure)
回答3:
You don't need to specify port 22; that's the default port for SSH. Also, SSH is the default if you specify user@server:path
.
Try cloning with just...
user@server:~/repo.git
instead.
来源:https://stackoverflow.com/questions/8427732/git-repo-git-is-not-a-git-command