Home > Software engineering >  Personal Access Token in .git config
Personal Access Token in .git config

Time:01-09

I was getting this error when trying to pull from gitlab.

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.

I don't have 2FA and found this solution to work:

Now my token is inside of the config file in .git.

I know that .git has enough information to restore the whole project from scratch. So if I push the project, will that expose my token?

CodePudding user response:

No. Files inside the git dir (.git) are not tracked, Only the stuff from the work tree. Try cloning from the current repo to another folder on your machine. You will not find the token in the new clone - same for pushing.

e.g.

git clone C:\my-git D:\clone-of-my-git
  • Related