我是 Git/Github 的新手,所以请原谅我的困惑!
问题在于:我刚刚对本地存储库进行了更改,并想推送到 Github 上的源(特别是 gh-pages)。以前,我一直在使用另一个 Github 帐户,所以我更改了我的“user.name”和“user.email”以匹配我现在尝试推送到的帐户。
截至目前,我收到 403 错误并且权限被拒绝。
我错过了什么步骤?离开我发现的其他答案,似乎更改我的 user.name 和 user.email 应该可以解决问题。我需要更改 git config 中的设置才能使其正常工作吗?
欢迎任何帮助、建议或建设性的批评,我只是渴望让它工作!
最佳答案
通过运行 git config --global credential.helper
检查您的 git 安装是否使用 OSX Keychain 来存储凭据。如果返回 osxkeychain
那么它就是。
来自 https://help.github.com/articles/updating-credentials-from-the-osx-keychain/ :
You'll need to update your saved username and password in the git-credential-osxkeychain helper if you change your password or username on GitHub.
- In Finder, search for the Keychain Access app.
- In Keychain Access, search for github.com.
- GitHub Password Entry in KeychainFind the "internet password" entry for github.com.
- Edit or delete the entry accordingly.
您可能需要检查的另一件事是,您是否正在为您推送的 github 帐户使用 2 因素身份验证?如果你是那么你可能需要来自 here 的这个:
When 2FA is enabled
If you have two-factor authentication enabled, you must create a personal access token to use as a password when authenticating to GitHub on the command line with HTTPS URLs.
For example, when you access a repository using Git on the command line using commands like git clone, git fetch, git pull or git push with HTTPS URLs, you must provide your GitHub username and your personal access token when prompted for a username and password.
For more information on setting up two-factor authentication, see "Adding security to your account with two-factor authentication."
关于git - 无法访问Github 403错误: Permission Denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40619447/