How to update PAT when moving to new computer

I have a well established VSCode setup that talks to Gitlab for source control.
The computer (an Intel Mac) it is on is old, and I recently updated to a new base unit (a new M2 Mac).
I copied over the entire file-tree used by the existing VSCode setup to the new computer.

On the original computer the link between VSCode and Gitlab is still working just fine.

On the new computer, all works fine, except that when I try to access Gitlab (e.g. fetch / sync etc.)
VSCode reports

"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

I am assuming that I need to install a new PAT on the new computer.

I have generated a new PAT … but can find no meaningful instructions about how I tell VSCode / Git to use thew new PAT… The Gitlab help page referred to simply covers what to do to regenerate a PAT.

The new PAT works OK … if I enter something like this

git clone ""

the project is cloned successfully (i.e. gitlab authenticates using the new PAT).

However after doing this if I then attempt to sync local changes to gitlab (something that works fine on my old computer) I still get the error about authentication failing.

Can anyone give some insights about what I do to resolve this?

Thanks in advance for any help that can be provided.

PS. A couple of years ago I had a similar (but different) issue … it was resolved very successfully via a thread in this forum. Sadly the steps described there (which are for a different starting issue I think) do not seem to help resolve this issue.

Just to let anyone know who is reading this, as I needed to resolve this promptly I fixed this the long hand way: I setup new clones of the Gitlab projects on my computer, updated the contents to reflect local changes since I changed base unit, and then simply moved these downloaded projects back to the original filetree.

This worked - but I suspect there is much more elegant way of doing the same thing.

1 Like