Dav*_*ave 5 git github local token
我在我的 Mac 上本地签出了一个现有的 GitHub 存储库。由于 Git 需要个人访问令牌,我使用此处的说明创建了一个 - https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating -a-个人访问令牌。但是,当我尝试推送本地更改时,不会提示我输入令牌......
$ git push
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/myrepo/maps.git/': The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud)
如何设置本地存储库以使用我刚刚创建的令牌?
感谢您的问题,尝试一下,它会起作用,
git remote set-url origin https://yourgithubusername:yourpersonalaccesstoken@github.com/yourgithubusername/reponame.git
然后,
添加所有更改git add .
承诺git commit -m "commit message"
推动变更git push origin main
小智 5
生成令牌后,请转到Keychain AccessMac 中的应用程序。搜索github.com,双击,选择Show Password,然后输入您的 macbook 密码,然后输入。您现在将能够看到密码,只需粘贴您已经生成的令牌,然后保存更改。
就是这样
| 归档时间: |
|
| 查看次数: |
5649 次 |
| 最近记录: |