当我在 Github 中推送我的代码时,Ubuntu 会出现远程权限错误

When I push my code in Github then remote permission error comes in Ubuntu

提问人:Hamza Bilal 提问时间:11/1/2023 最后编辑:kometenHamza Bilal 更新时间:11/5/2023 访问量:45

问:

当我在 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$ 


在此处输入图像描述

Git GitHub 推送

评论

0赞 phd 11/1/2023
"hamzbialal 拒绝对 hamzaabialal /chat-website.git 的许可。"
0赞 Ulrich Eckhardt 11/5/2023
我想知道你为什么要在现有的 git 存储库中调用 git。另外,为什么要在问题中添加文本图像?请改用文本。作为这里的新用户,也请浏览并阅读如何提问

答:

1赞 Farhad85 11/1/2023 #1

若要解决此问题,可以执行以下任一操作:

  1. 添加与远程 URL 匹配的默认主机;
  2. 使用 git remote set-url 命令设置远程 URL;
  3. 将文件更新为主机中的某个 URL。.git/config