无法同步到 Github,之前的用户仍然拥有同步功能

Cannot Sync to Github, previous user still holds sync functionality

在工作中,我最近换用了一个自由职业者以前使用过的 Mac(离开很久了)。我为 Mac 下载并登录 Github,将当前的 Repo 克隆到桌面并编码,在提交几次后我去同步并返回:

"You may not have permission to access superTween. Check Preferences to make sure you’re still logged in."

经过进一步调查,git 推送终端返回:

remote: Permission to {{current repo}}.git denied to {{freelancers email}}.

fatal: unable to access '{{current repo}}.git/': The requested URL returned error: 403

很明显之前的用户没有正确退出?无论哪种方式,我都通过该应用程序注销并再次登录。仍然不走运,用我的登录名生成了一个新的 SSH 密钥……没什么,干净地重新安装 github(使用 this code)……仍然没有。

然而,终端也显示:

$ ssh -T git@github.com Hi {{myuserName}}! You've successfully authenticated, but GitHub does not provide shell access.

如何删除之前将自己附加到我的同步设置的用户?

错误

Error: The requested URL returned error: 403 while accessing
https://github.com/Joey-project/repo.git/info/refs
fatal: HTTP request failed

过去在这里讨论过!

也许您已经知道,但这可能是因为从本地计算机到服务器的登录凭据错误。

如果我没记错的话,一般的做法是

(1) 确保你有一个稳定的 git 版本

(2) 确保遥控器正确

(3) 如果启用了 2FA,则提供访问令牌

(4) 检查您的权限(username/password)

(5) 使用 ssh 代替 https

我不完全确定它是否涵盖了所有内容,但也可以查看:Why can't I clone any repository in Git? .

祝你好运! :)

乔伊

您遵循的脚本不会删除文件夹(我已将此更改发送给作者)。 运行 它并在终端中也这样做:

rm -rf "~/Library/Application Support/com.github.GitHub.ShipIt"
mv .gitconfig .gitconfig_
mv .config/git/ .config/git_/

然后重试。

第一行删除 GitHub 对 Mac 的另一个偏好 第二个和第三个重命名 git 首选项(如果有)。如果您没有更改它们,您将不需要它们。但以防万一,我不会立即删除它们。 您可以使用

安全地删除它们
rm .gitconfig_
rm -rf .config/git_/

已解决,问题是我的 OS 从前一个用户那里保存了一个用于 github 网络登录的钥匙串,由于某种原因优先。修复过程是:

删除钥匙串 重新运行git移除 重新生成ssh key 正常安装和登录

编辑:来自 github 帮助的回复:

If you're using an HTTPS remote URL, your SSH key won't be used. If you're not prompted for your GitHub credentials when accessing GitHub over HTTPS, this means they're cached locally.

You'll need to open the Keychain Access application and search for any "github" entries to double-check that the correct credentials are entered.

感谢大家的帮助