Switching from using password to using personal access token

Hey All,

I have followed the instructions at [1] to generate a personal access token (PAT). However, I’m not sure what to do with the token, e.g. how when I try to push to a repo from the command line to have it ask for me to enter my PAT as opposed to my password (I know using passwords is now deprecated).

Thanks in advance for your help!

Best,
Mary

  1. Creating a personal access token - GitHub Docs

Enter the PAT when asked for your password and it should work. :slightly_smiling_face:

I tried that initially and it didn’t work; however I found a solution here: git - gitlab - Push to a repository using access_token - Stack Overflow that worked for me.

Thanks for writing in to help!

I’m having a similar problem: I get a 403 when I try the push using the PAT as the password. What fix from the Stack Overflow page worked for you?

From [1], I did:

git remote add origin https://<access-token-name>:<access-token>@gitlab.com/myuser/myrepo.git
Note that this stores the access token as plain text in the .git\config

file. To avoid this you can use the git credential system, providing the access token name for “username” and the access token for “password”. This should store the credentials in the git credential system in a more secure way.

I hope this helps! 
  1. git - gitlab - Push to a repository using access_token - Stack Overflow

Sorry for weird formatting above, I was copying and pasting from some running notes I kept on the fix, hope it’s still readable, despite the random bold words.