【问题标题】:multiple github accounts on linux - cannot push to remote, but can pullLinux 上的多个 github 帐户 - 无法推送到远程,但可以拉取
【发布时间】:2021-04-10 01:27:32
【问题描述】:

我按照本文中的说明在我的 ubuntu 机器上设置了多个 GitHub 帐户:https://www.freecodecamp.org/news/manage-multiple-github-accounts-the-ssh-way-2dadc30ccaca/

我可以从存储库中提取,但我无法推送。我不断收到拒绝访问错误:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这是我的 ssh 配置的样子:

Host github.com  
    HostName github.com
    IdentityFile ~/.ssh/github
    IdentitiesOnly yes
    Port 22

Host cloudcountry.github.com  
    HostName github.com
    IdentityFile ~/.ssh/id_rsa_cloudcountry
    User git
    IdentitiesOnly yes
    Port 22

Host gitlab.com  
    HostName bitbucket.org/
    IdentityFile ~/.ssh/cloudsun_id_rsa
    IdentitiesOnly yes
    Port 22

这些是 git 遥控器 git remote -v

origin  git@cloudcountry.github.com:cloudcountry/repo-name.git (fetch)
origin  git@cloudcountry.github.com:cloudcountry/repo-name.git (push)

不确定我可能会错过什么。

【问题讨论】:

  • 正如我上面提到的,它是一个 ubuntu 机器。我可以通过浏览器登录。我也可以从存储库中提取。我唯一遇到的问题是推动。
  • origin git@cloudcountry.github.com:cloudcountry/repo-name.git (fetch) origin git@cloudcountry.github.com:cloudcountry/repo-name.git (push)

标签: git github ssh ssh-keys ssh-keygen


【解决方案1】:

你应该:

  • 测试您的 URL 以查看身份验证是否成功:

      ssh -Tv git@cloudcountry.github.com
    
  • 冲洗检查回购 URL。
    例如:https://github.com/cloudcountry 不存在(并且通过扩展,https://github.com/cloudcountry 下的任何存储库都不会存在/不可访问,无论使用什么私有 SSH 密钥)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-18
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多