alexvasilkov / GradleGitDependenciesPlugin

Gradle plugin to add external git repos as project dependencies
Apache License 2.0
105 stars 15 forks source link

I can't connect to a private repo anymore #30

Open fabriceci opened 2 years ago

fabriceci commented 2 years ago

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 git@github.com and it works fine : Hi fabriceci! You've successfully authenticated, but GitHub does not provide shell access.

Here if my config:

git {
    implementation 'git@github.com: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?

alexvasilkov commented 2 years ago

Try removing authGroup 'ssh', does it help?

fabriceci commented 2 years ago

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.)

alexvasilkov commented 2 years ago

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?

fabriceci commented 2 years ago

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)

alexvasilkov commented 2 years ago

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.

fabriceci commented 2 years ago

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 🎉