How to renew PAT on mac with VSCode?

A while back I set up a Gitlab instance for source control, using it within VSCode.
It worked / works just fine.
Then in August I moved to a new computer and found there was no documentation at all about how to migrate the PAT when moving to a new computer - and ended up having to completely recreate my file trees locally to work-around the PAT issue.
Now the PAT that was installed by that process has expired.
I’ve generated a new PAT without problem, but once again hit the documentation wall wherein there are simply no resources around describing what I need to do to tell VSCode / Git / Gitlab that I have a new PAT.
Frankly this is an idiotic state of affairs - I’m sure I am not the only person using VSCode on a mac to access repositories in Gitlab, so it would seem helpful / sensible for there to be some guidance about what I need to do.
Possibly it is ‘hidden in plain sight’ and absurdly easy to do - however regardless, I don’t know what those obvious steps are, and it would be helpful to know so I don’t have to keep asking these questions!
I really don’t want to have to delete my existing file trees and start the whole process all over again - there must be a better way forward.
Hopefully someone reading this knows either what I should do, or can point me to somewhere where I might find some guidance.
Thanks in advance for whatever advice / insight you can share on this

Hi @jcogs :wave:

For re-authenticating the VSCode Extension on a new machine or after your PAT expires, you should be able to do the following:

  1. From the VSCode command palate, choose GitLab: Add Account
  2. Enter the URL to your GitLab instance (including the http:// or https://) and press Enter
  3. Paste in your new GitLab personal access (with api and read_user token scopes) and press Enter.

Note: anyone using GitLab.com can also run the command GitLab: Authenticate to GitLab.com to authenticate using OAuth. This option is not available for self-managed however.

Moving forward, you might also consider using SSH keys and using Git over SSH for GitLab projects as an option:

Thanks @gitlab-greg for the info.
I’ve tried using SSH as per your instructions.

  • Generated new SSH key
  • Added key to my Gitlab Account
  • Attempted to confirm SSH connection as per notes (ssh -T jcogs@gitlab.com) but this repeatedly fails with error Pemisson denied (publickey)
  • Ran the test again with -Tv option and in this output I see
debug1: Host 'gitlab.com' is known and matches the ED25519 host key.
  • This suggests that the keys are matching so I looked further through the debug output and saw this
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
  • At which point it attempts to use the key provided and these fail…

I have confirmed that the key on Gitlab is the public key for the key generated.
I am guessing that I’m missing something in the cryptic documentation … I cannot see any way discussed in the SSH page linked to that explains how to link “agent identity” to the key … do you have any ideas what might be going on / how I might get this resolved?

Thanks in advance for any guidance you can offer.