GITHUB Push failed: failed with error: fatal:无法访问



之前,i用户A账号在Android Studio上推送代码。现在我注销并将B帐户更改为Push。当push出错时:

Push failed: Failed with error: fatal: unable to access 'https://github.com/thangcoder/demo.git/': The requested URL returned error: 403

和下面的错误,当我在命令:

$ git push -u origin master
remote: Permission to thangcoder/demo.git denied to trangchongcheng.
fatal: unable to access 'https://github.com/thangcoder/demo.git/': The requested URL returned error: 403

(trangchongcheng is A Account)

请为我提意见,谢谢大家。

我得到了同样的错误。下面是修复方法:

问题是你的git存储库被SSH密钥保护。

登录到GitHub>项目的存储库>Settings选项卡>Deploy keys

删除为您的桌面分配的密钥。

并尝试再次从Android Studio推送存储库。

关于推送存储库,请参阅:"如何在Android Studio中使用GitHub"。

这对我有用!

很明显你没有写repo的权限。请让thangcoder给你添加写权限

检查您的计算机是否具有向该存储库推送的权限。

如何检查:

登录到你的github账户,直接到这个链接:https://github.com/settings/keys

现在你看到你的机器在那个链接上了吗?如果没有,请添加一个密钥以使您的机器能够推送到远程存储库。

如何添加一个关键:

https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

修改文件。git/config

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://你的github用户名:你的github密码@github.com/Pandaring/Demos.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

我有这个问题,请这样做:

1.git config --global --unset user.name
2.git config --global --unset user.email
3.git remote add origin https://github.com/username/file.git
4.git push -u origin master

我刚刚遇到了同样的问题,找到解决方案非常耗时。实际上读取错误是有帮助的:

Push failed: failed with error: fatal: 无法访问

好吧,这就是重点。只需将用户作为协作者添加到存储库。

https://help.github.com/articles/inviting-collaborators-to-a-personal-repository/

注意:仅将用户添加到组织中是不够的。

相关内容

最新更新