当我将代码推送到 Github 时,Ubuntu 中出现远程权限错误。 我想将我的代码推送到我的 Github 存储库中,但是出现了这个错误
hamza@hamza-HP-EliteBook-840-G1:~/PycharmProjects/pythonProject/chat-website$ git init
Reinitialized existing Git repository in /home/hamza/PycharmProjects/pythonProject/chat-website/.git/
hamza@hamza-HP-EliteBook-840-G1:~/PycharmProjects/pythonProject/chat-website$ git status
On branch main
Your branch is based on 'origin/main', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
nothing to commit, working tree clean
hamza@hamza-HP-EliteBook-840-G1:~/PycharmProjects/pythonProject/chat-website$ git init
Reinitialized existing Git repository in /home/hamza/PycharmProjects/pythonProject/chat-website/.git/
hamza@hamza-HP-EliteBook-840-G1:~/PycharmProjects/pythonProject/chat-website$ git status
On branch main
Your branch is based on 'origin/main', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
nothing to commit, working tree clean
hamza@hamza-HP-EliteBook-840-G1:~/PycharmProjects/pythonProject/chat-website$ git add .
hamza@hamza-HP-EliteBook-840-G1:~/PycharmProjects/pythonProject/chat-website$ git status
On branch main
Your branch is based on 'origin/main', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
nothing to commit, working tree clean
hamza@hamza-HP-EliteBook-840-G1:~/PycharmProjects/pythonProject/chat-website$ git push -u origin main
remote: Permission to hamzaabialal/chat-website.git denied to hamzbialal.
fatal: unable to access 'https://github.com/hamzaabialal/chat-website.git/': The requested URL returned errorlike so
: 403
hamza@hamza-HP-EliteBook-840-G1:~/PycharmProjects/pythonProject/chat-website$
要解决此问题,您可以执行以下任一操作:
Add a default Host matching remote url;
Setting remote url using git remote set-url Command;
Update .git/config file to one of the urls in Host.