代码之家  ›  专栏  ›  技术社区  ›  Addem

可以拉动Git回购,但不能推动

  •  0
  • Addem  · 技术社区  · 5 年前

    .pub 文件并粘贴到GitHub用户范围的SSH密钥框中。我打电话来 git pull 而且很有效。我打电话来 add commit 一切似乎都很好。

    但后来我打电话 git push -u origin main 我得到了

    ERROR: Permission to name/repo.git denied to deploy key
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    
    3 回复  |  直到 5 年前
        1
  •  4
  •   bk2204    5 年前

    当您将生成的公钥上传到GitHub时,您将其放入perrepositorydeploykey框中。部署密钥是设计用于在单个存储库上操作的SSH密钥,默认情况下是只读的。如果希望公钥是读写的,则在添加公钥时必须选中该框。这是因为在许多情况下,deploy键只用于部署代码,所以最好不要授予它们不需要的访问权限。不过,它们也可以用于其他机器操作,因此可以进行写访问。

    如果您打算对整个用户帐户而不仅仅是这个特定的存储库执行此操作,那么您需要删除deploy key条目并将其上载到中 your user settings

        2
  •  0
  •   Dharman vijay    5 年前
    Specifically they say add the following to ~/.ssh/config
    
    Host *
     AddKeysToAgent yes
     UseKeychain yes
     IdentityFile ~/.ssh/id_rsa
    

    https://stackoverflow.com/a/43054414/6521970

    推荐文章