Gitlab auth with personal access token

Hi, i’m trying to authenticate via gitlab workflow extension in vsCode? After:

  1. adding my username url : https://gitlab.com/usernamehereinput
  2. entering my personal access token created in my preferences
    I’m getting an error that just says “request failed.”
    Can anyone help?
    thank you!

Hi @papalove ,

When GitLab Workflow extension prompts you to put in the URL to GitLab instance, try putting in https://gitlab.com instead of https://gitlab.com/usernamehere.

Although gitlab.com/usernamehere is the URL to your user profile, that URL is not going to work for authentication purposes. You’ll want the main URL for the GitLab instance which for GitLab.com will be https://gitlab.com.

Alternatively, you can try running the command GitLab: Authenticate to GitLab.com to authenticate using OAuth.

Hey Greg! Thank you so much. That seemed to be the issue but I got this new error:

“Account for instance https://gitlab.com and user papalove already exists. The extension ignored the request to re-add it. You can remove the account with the “GitLab: Remove Account from VS Code” command and add it again.”

What do you advise?

thank you @gitlab-greg !!!

@papalove I’ve seen that error before too. :thinking: Can you try removing your account from VS code and then adding it again? That usually fixes it for me.

1 Like

@gitlab-greg that did work! But… Though it does some it partly synced as I’m seeing pipeline history and issues… Sadly, : ( i’m still not able to git push. Error:
"remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See Troubleshooting Git | GitLab
fatal: Authentication failed for ‘https://gitlab.com/.../…’

Hi again @papalove. :slight_smile:

Can you verify that the personal access token you’re using was generated has the api scope? If not, can you try it using a token with both the api and the read_user scope?

If that still doesn’t work, you can try running GitLab: Authenticate to GitLab.com in VSCode to authenticate using OAuth.

Thank you @gitlab-greg so… 1) i did have the api scope but i went ahead and created a new token with read_user 2) i tried to push got an error 3) i opened the palate and tried to connect and received the message that i’m already connected 4) i disconnected 5) i opened the palate and tried to add the account and received this error: “The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password.” 6) Additionally i received a pop over notice that said the account was added and it reconnected the view of my commit history :woozy_face: oh and the command

is saying: zsh: command not found: GitLab: :dotted_line_face: