英文:
Personal Access Token in .git config
问题
我在尝试从GitLab拉取时遇到了这个错误。
远程:HTTP基本认证:访问被拒绝。
提供的密码或令牌不正确,或者您的帐户启用了双因素身份验证(2FA),必须使用个人访问令牌而不是密码。
我没有启用2FA,并发现这个解决方案有效:
现在我的令牌已经存储在.git目录下的配置文件中。
我知道.git目录中包含足够的信息,可以从头开始还原整个项目。所以如果我推送项目,会暴露我的令牌吗?
英文:
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?
答案1
得分: 1
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
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论