ef-labs / stash-hook-mirror

An Atlassian Stash repository hook for mirroring to one or more remote git repositories.
MIT License
77 stars 58 forks source link

Mirror to an external server that require a ssh key #18

Closed weirdfoo closed 10 years ago

weirdfoo commented 10 years ago

I'm trying to mirror my changes to another server that I can only connect using public key authentication. The problem is that I can't find how to specify my key and the remote ssh server connection always fail. I tried setting the key in the stash user's .ssh folder without success. Any Idea ?

The error I get is :

Failed in pushing to mirror: An error occurred while executing an external process: '/usr/bin/git push server' exited with code 128 saying: Host key verification failed. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

adrianluisgonzalez commented 10 years ago

Hi, the error message suggests either the remote repository url is invalid, or you don't have access.

To verify I would try running the git command manually as the user stash runs as. Make sure the private key is installed for that user. From the command line, go to the appropriate repository directory (you can find the location on the Repository Settings tab -> Repository details -> Location on disk). Run $ git push --prune git_repository_url +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/*

If this works, let me know as it sounds like a bug with the plugin. If this does not work then it seems like one of the following:

Hope this helps.

weirdfoo commented 10 years ago

Interesting, once I did it in command-line once and accepted the ssh fingerprint of the remote server it's now working correctly with the mirror plugin.

Thanks :)

adrianluisgonzalez commented 10 years ago

Glad to hear it is working, I'll add this to the wiki.