Hi all,
some time ago, I wrote an article about authentication against Git repositories with JGit (a pure Java Git implementation). Now I am about to update a section about the authentication methods provided by GitLab and how they work.
From my understanding, Oauth tokens (those managed under Profile Settings > Applications) can be used to access private repositories. So I created a private repository and an Application named foo
for testing. The secret generated by GitLab is a1b2c3
. However, attempting to clone the repository with
git clone https://foo:a1b2c3@gitlab.com/user/repo.git
gave me this error
not authorized
I also tried these variants
git clone https://oauth2:a1b2c3@gitlab.com/user/repo.git
git clone https://a1b2c3@gitlab.com/user/repo.git
git clone https://foo@gitlab.com/user/repo.git
password: a1b2c3
But all resulted in the same error.
The experiments described here were all made with GitLab community edition (gitlab.com). Is my assumption that Oauth can be used to authenticate against repositories wrong? Or can someone give me a hint what I am doing wrong?
Thanks in advance,
Rüdiger