mschonaker / wagon-git

Git Wagon for Apache Maven
http://synergian.github.io/wagon-git/
83 stars 32 forks source link

ssh key can't have another name than "“id_rsa”" #37

Closed Toofoo closed 7 years ago

Toofoo commented 8 years ago

I tried to deploy an aar library to my private bitbucket Repository (from windows7). On my PC I used 2 different RSA ssh key: the default named "id_rsa" was for another purpose so I defined a specific "mybitbucketkey" rsa key for bitbucket and in my /.ssh dir I wrote a config file defining the alias : Host bitbucket.org HostName bitbucket.org PreferredAuthentications publickey IdentityFile ~/.ssh/ mybitbucketkey

This works perfectly for any commit (from git bash or Android Studio) but doesn't work for deploying artifact with wagon-git (through gradle). I obtained a "permission denied". The only solution was to use only the ssh key named "id_rsa". Is there a way to use another generated private key than "id_rsa"?

mschonaker commented 8 years ago

I can't be of help here. I use it with Linux and Maven (not Gradle). I think that is a problem is related to the SSH tool you're using or to a component of Gradle.

sytolk commented 7 years ago

I have the same problem with Linux and Maven. Its only work with id_rsa key. I have use ssh-keygen to create butbucket.pub and private key and add public in bitbucket.org SSH keys. Private in Maven settings.xml but it not works with maven wagon-git (public key problems..) But when I have import existing id_rsa.pub in bitbucket an start mvn deploy works.

mschonaker commented 7 years ago

Would you please share a any error message or console output you've got? That could be very helpful. Thank you.

sytolk commented 7 years ago

My problem was that I have many rsa keys in .ssh folder id_rsa is default. After create config file in .ssh problem is solved. Thanks!

Toofoo commented 7 years ago

@ sytolk : could you please detail how you solve the problem? Because in my issue description you can see that I also use a config file in .ssh in order to use several rsa key with different name but the problem is that wagon-git only recognise the default name "id_rsa".

sytolk commented 7 years ago

@Toofoo (don`t leave space between @ nickname) this is my config to access my private Maven repo in bitbucket.org

stanimir@debian:~/.ssh$ ls
bitbucket  bitbucket.pub  config  id_rsa  id_rsa.pub  known_hosts  known_hosts.old
stanimir@debian:~/.ssh$ cat config 
Host bitbucket
HostName bitbucket.org
IdentityFile ~/.ssh/bitbucket

and in maven/conf/settings.xml

<server>
       <id>bitbucket-repo-id</id>
       <privateKey>/home/stanimir/.ssh/bitbucket</privateKey>
       <passphrase></passphrase>
    </server>