Git: 对我自己的存储库的权限被拒绝

Git: Permission to my own repository denied

每当我尝试将我的代码推送到其存储库时,我都会收到以下错误:

remote: Permission to Sam-Olendi/dentioapp.git denied to samolendi.
fatal: unable to access 'https://github.com/Sam-Olendi/dentioapp.git/': The requested URL returned error: 403

到目前为止,我一直在毫无问题地推送代码。我最近将代码推送到一个 bitbucket 存储库,现在看来我用来访问该存储库的凭据现在正在使用。

我已经尝试了以下命令,none 有效:

git config --global user.name "Sam-Olendi"
git config --global user.email "sam.olendi@gmail.com"
git commit --author="Sam-Olendi <sam.olendi@gmail.com>"
git commit --amend --author="Sam-Olendi <sam.olendi@gmail.com>"

我最近也将我的 git 版本更新到了最新版本。当我登录到 bitbucket 时,会弹出一个对话框并询问我的凭据。如何覆盖正在使用的凭据?

这是git config -e的输出:

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
        hideDotFiles = dotGitOnly
[remote "origin"]
        url = https://github.com/Sam-Olendi/dentioapp.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "heroku"]
        url = https://git.heroku.com/dentioapp.git
        fetch = +refs/heads/*:refs/remotes/heroku/*
[gui]
        wmstate = normal
        geometry = 887x427+52+52 171 192

我认为这里的关键是您使用 HTTPS 克隆了新的存储库,并且我假设(直到您回复我的评论)您正在使用 Windows,这使得以下内容更加相关。我怀疑你的凭证被凭证助手缓存了。

看到这个:https://help.github.com/articles/caching-your-github-password-in-git/#platform-windows

在 windows 上,如果您使用了 wincred 帮助程序 (git config --global credential.helper wincred),那么这会将您的凭据存储在 Windows 凭据存储中,该存储有一个控制面板界面,您可以在其中可以删除或编辑您存储的凭据。例如看这个:

在这家商店,您的详细信息由您的 Windows 登录名保护,并且可以在多个会话中保留。这是在 Git 中为 Windows 1.8.1.1 添加的。

所以要么:

  1. 尝试使用以下方法清除 https 克隆存储库的凭据缓存,然后重试:

    git credential-osxkeychain erase host=github.com protocol=https

或者,

  1. 使用 Windows 控制面板的凭据管理器编辑凭据。