git-credential-oauth
git-credential-oauth copied to clipboard
Custom GitLab instance support
To use with a custom GitLab instance, eg. gitlab.example.com
- Register an OAuth application on the host
- Browse to eg. https://gitlab.example.com/-/profile/applications
- Specify name git-credential-oauth
- Specify redirect URI http://127.0.0.1
- Uncheck 'Confidential'
- Select scopes read_repository and write_repository
- Click button 'Save application'
- Copy the generated client id
- Run the command below, adjusting the URL and client id
- Share this command with colleagues
git config --global credential.https://gitlab.example.com.oauthClientId <CLIENTID>
If you'd like universal GitLab support without configuration, please vote for issue https://gitlab.com/gitlab-org/gitlab/-/issues/374172
Screenshot 
Does this work this 2FA enabled?
Does this work this 2FA enabled?
@alexeadem Yes
Does this work this 2FA enabled?
@alexeadem Yes
I'm getting this error.
GitLab Community Edition 14.0.12 git version 2.43.0
Please complete authentication in your browser...
https:///$GIT_HOST/oauth/authorize?client_id=0c5c59af20013c6ed40b17ac7e8532fb7aad6b6aa96811e56d14f2c071c8e8b8&code_challenge=ZwvNnQOj8oKBv5mn-wHiUfhOuLmGsN6KXLogGzbT7Do&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%3A40859&response_type=code&scope=read_repository+write_repository&state=S0ynjJY_0VVp2STKRYYFOdIEnvL1oxn-81YrB5gFB-0
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://$GIT_HOST/$USER/$REPO-src.git
Browser redirect says authentication is successful....
Success. You may close this page and return to Git.
—[git-credential-oauth](https://github.com/hickford/git-credential-oauth)
I'm getting this error.
remote: HTTP Basic: Access denied fatal: Authentication failed for 'https://$GIT_HOST/$USER/$REPO-src.git
@alexeadem Are you sure you have permissions to access that specific repo? Are you trying to fetch or pull?
You can debug some more:
echo url=https://gitlab.example.com | git credential fill
The username must be oauth2, not your username.
I'm getting this error.
remote: HTTP Basic: Access denied fatal: Authentication failed for 'https://$GIT_HOST/$USER/$REPO-src.git@alexeadem Are you sure you have permissions to access that specific repo? Are you trying to fetch or pull?
I just tested on version GitLab Community Edition v16.9.0 with the same configuration and it working fine. Maybe something different with GitLab Community Edition 14.0.12