Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom GitLab instance support #18

Open
hickford opened this issue Apr 18, 2023 · 6 comments
Open

Custom GitLab instance support #18

hickford opened this issue Apr 18, 2023 · 6 comments
Labels

Comments

@hickford
Copy link
Owner

hickford commented Apr 18, 2023

To use with a custom GitLab instance, eg. gitlab.example.com

  1. Register an OAuth application on the host
  2. Copy the generated client id
  3. Run the command below, adjusting the URL and client id
  4. 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

@hickford
Copy link
Owner Author

Screenshot image

@alexeadem
Copy link

Does this work this 2FA enabled?

@hickford
Copy link
Owner Author

Does this work this 2FA enabled?

@alexeadem Yes

@alexeadem
Copy link

alexeadem commented Feb 19, 2024

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)

@hickford
Copy link
Owner Author

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.

@alexeadem
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants