Question

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

git init

and add & commit a test file test. 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 push

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?

Était-ce utile?

La solution

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:

ssh://git@server:7999/project/repo.git

For http URLs, you use the username and the http port (7990 by default)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top