publickey-authentication on git/stash for ssh not working
I’m trying to work with git/stash but I’m having a bit of a problem with the publickey-authentication. Here’s what happens:
hannibal is a user on the stash-server.
hannibal has read/write-permission for one repository and an ssh-publickey added to his stash-account. I now create a repository via
commit a test file
Then I want to add the stash-repository as origin
git remote add origin hannibal@stash:7999/path/to/repository.git
which yields no further output. Now I try to
git push origin master
which in turn asks me for the password (which is strange, since it should authenticate via publickey). I enter the password and the following error message displays on the screen:
Could not chdir to home directory /home/hannibal: No such file or directory fatal: '7999/path/to/repository.git' does not appear to be a git repository fatal: The remote end hung up unexpectedly
The URL is definitely correct, since it’s the one that stash gives me. Also ssh is enabled on the stash-server. What am I missing here?
One Solution collect form web for “publickey-authentication on git/stash for ssh not working”
The URL for ssh remotes should be prefixed with ssh:// and the username should be git (Stash will find the correct key for your hannibal user automatically). The full form of the URL is:
For http URLs, you use the username and the http port (7990 by default)