簡體   English   中英

Github:如何推送到我無權克隆的組織的存儲庫

[英]Github: How can I push to an organization's repo that I don't have permissions to clone

我有兩個 github 帳戶。 我已經為兩者創建了 SSH 密鑰,並相應地配置了它們。 我知道我的配置有效,因為我可以將我的個人存儲庫推送到兩個帳戶。 示例配置

Host github.com
etc
IdentityFile: id_rsa

Host github-second
etc
IdentityFile: id_rsa_second

要為我的普通帳戶添加遠程,我使用git remote add origin git@github.com:account/repo.git要為第二個帳戶添加遠程,我使用git remote add origin git@github-second:second-account/other-repo.git

我現在是一個組織的成員,擁有我的第二個帳戶。 感興趣的 repo 的 url 看起來像github.com/organization/org-repo vs github.com/second-account/org-repo 我嘗試使用以下方法添加組織存儲庫: git remote add origin git@github-second:organization/org-repo並且我確實在本地計算機上獲得了存儲庫文件。 但是,我無法推送到組織存儲庫。 錯誤:

fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.```

I have contacted the organization and they said that I have full write access. 
I am not sure what else to try.

我通過以下方式修復它:

  1. 重新添加 id_rsa_second
  2. 檢查ssh -T git@github-second並確保它指向second-account
  3. git remote add origin git@github-second:second-account/org-repo.git
  4. git remote add upstream git@github-second:org-account/org-repo.git
  5. 推向上游。 希望這對其他人有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM