git - 无法访问Github 403错误: Permission Denied

标签 git github jekyll github-pages

我是 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.

  1. In Finder, search for the Keychain Access app.
  2. In Keychain Access, search for github.com.
  3. GitHub Password Entry in KeychainFind the "internet password" entry for github.com.
  4. 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/

相关文章:

git - git如何跟踪文件的变化

Git:将本地存储库复制到另一个文件夹

ruby - 如何从 Jekyll 插件中调用 `handleize` Liquid 过滤器?

jekyll:将所有文件保存在目标文件夹中

git - 删除一个分支,包括它的提交

git diff 分支 --name-status --ignore

git - 我怎样才能从 gitosis 中得到头部?

git - "failed to open '/etc/gitconfig ' - permission denied"使用 GitKraken 克隆存储库时

git - 5 次提交到错误的分支并推送到远程/源

git - Jekyll 的 GitHub 页面中的帖子链接错误