GradleGitDependenciesPlugin icon indicating copy to clipboard operation
GradleGitDependenciesPlugin copied to clipboard

I can't connect to a private repo anymore

Open fabriceci opened this issue 2 years ago • 6 comments

I reopened a project where I was using a private repo with HTTPS authentication and an AuthGroup, it worked fine but it seems we can't use this type of authentication with Github anymore (if I'm not mistaken).

I didn't find how to use an access token (I tried replace the password by the token), so I tried with SSH but got the following error:

Failed to notify build listener.
> Invalid remote: origin

I try if my SSH connexion is valid with ssh -T [email protected] and it works fine : Hi fabriceci! You've successfully authenticated, but GitHub does not provide shell access.

Here if my config:

git {
    implementation '[email protected]:fabriceci/xxx.git', {
        authGroup 'ssh'
        keepUpdated false
    }
}

I was not sure, but I put my SSH password in my gradle properties file (As I used to do before the classic user/pass connection) :

 git.ssh.password=xxx

Have you an idea how to solve this?

fabriceci avatar Apr 13 '22 09:04 fabriceci

Try removing authGroup 'ssh', does it help?

alexvasilkov avatar Apr 13 '22 09:04 alexvasilkov

No, the same error. (Note as the ssh key is protected by a password, so the password should be added somewhere to expect to work.)

fabriceci avatar Apr 13 '22 09:04 fabriceci

Hm, I fear ssh keys protected with passphrase are not supported right now. Since you have access token, can you please try to use it as username and use empty password, does it help?

alexvasilkov avatar Apr 13 '22 09:04 alexvasilkov

Unfortunately not:

Git dependency: 'password' is not specified for 'xxx'.
You should provide 'git.main.password' as command line argument (-Dgit.main.password=...) OR in gradle.properties OR in local.properties OR in

Same for the inverse: Git dependency: 'username' is not specified for 'xxx'. (I already tried add the access token as the password)

fabriceci avatar Apr 13 '22 10:04 fabriceci

What if you use random password, e.g. "x"? If token auth doesn't work then I fear that you have to use unprotected ssh key after all. I may try to add passphrase support at some point in the future.

alexvasilkov avatar Apr 13 '22 11:04 alexvasilkov

I may try to add passphrase support at some point in the future.

It would be useful, the user/pass should also be replaced by access tokens. When you have the mood and the time! Thanks for your help!

I found a workaround for me without removing my SSH pass: When I set the token as the password, I don't notice the first time but it fails with a different error and creates empty folders in libs/ So I manually cloned the repositories inside them and it works 🎉

fabriceci avatar Apr 13 '22 11:04 fabriceci