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

  • Migrating Git hosts
  • Git Error : master -> master (missing necessary objects)
  • Stop mvn release triggering repeat Jenkins builds
  • Git and Visual Studio project references
  • This pull request cannot be merged. You will need to resolve conflicts to be able to merge
  • Checkout a Pull Request in Stash
  • 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?

  • How can I limit git log (or svn log) to revisions that regard one particular file?
  • Is there a way to `git submodule add` a repo *without* cloning it?
  • git gc --aggressive --prune=all does not remove big file from repository
  • How to make a composer depency commitable?
  • Pipe git diff to git apply
  • Lost my commit in GIT. Can you accidentally delete commits?
  • 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)

    Git Baby is a git and github fan, let's start git clone.