繁体   English   中英

我得到“致命:无法访问'存储库':请求的 URL 返回错误:403

[英]I get the "fatal: unable to access 'repository': The requested URL returned error: 403

我正在尝试将一些修改推送到 git 存储库中,但收到消息:“我收到fatal: unable to access 'repository': The requested URL returned error: 403

请允许我向您提供更多详细信息:

  1. 我在 Linux Ubuntu,20.04.3 LTS 上工作

  2. 我使用我最近生成的 PAT 作为密码。 (我很确定它没问题,因为它不会给我Authentication failed的错误。

  3. 在我的.bashrc文件中,我有以下几行:

git config --global user.name  "Niceno"
git config --global user.email "bojan.niceno.scientist@gmail.com"

这两个都是正确的,并且已经工作了好几年了。

  1. .git/config内容如下:
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://github.com/DelNov/T-Flows
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "development_branch"]
    remote = origin
    merge = refs/heads/development_branch

这并没有告诉我太多。 5. 如果我登录我拥有管理员权限的 Git 帐户DelNov ,我会看到用户Niceno ,我谦虚的我,被授予访问存储库的权限。

我真的很困惑,因为我正在尝试做我多年来一直在做的事情。 然而突然间,我不能做简单的推动。

任何意见,将不胜感激。

我读了你的解释,我希望这是做什么:

  1. git 添加。
  2. git commit -m "我的第一次提交"
  3. git 推送 https://username:password@github.com/username/repository.git --all

从评论中我了解到这是该项目第一次推送到存储库。 So in this case it's advisable to set the full url https://username:password@github.com/username/repository.git --all instead of just doing git push origin --all .

我了解您已经习惯了 git 命令行这一事实,但以防万一您忘记了某些内容,此链接也会对您有很大帮助

Go 到您的本地存储库文件夹并找到一个名为“.git”的隐藏文件夹。 在下面所附的文件夹中找到一个名为“config”的文件。
在此处输入图像描述

您需要更改 url = https://github.com/.. 到 SSH url 可以从 GitHub 存储库(在 git 中心 Web 门户网站上)找到锥形菜单,如下图所示。

在此处输入图像描述

这是更改 url 后配置文件的样子。 在此处输入图像描述

这解决了我的问题。 我相信这会有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM