簡體   English   中英

GIT:致命:創建新分支時無法從遠程存儲庫讀取

[英]GIT: fatal: Could not read from remote repository when you create new branch

我正在創建新分支,並嘗試推送分支(我嘗試了以下命令):

git push --all -u
git push origin NewBranch

但是在兩種情況下,我都會收到此錯誤:

Permission denied (publickey).
fatal: Could not read from remote repository.

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

這是我的.git / config:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = ssh://git@github.com/myName/myRepo.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        pushurl = ssh://git@github.com/myName/myRepo.git

這是起源:

origin  ssh://git@github.com/myName/myRepo.git (fetch)
origin  ssh://git@github.com/myName/myRepo.git (push)

你們誰都知道為什么會出現此錯誤?

非常感謝您的幫助

再檢查一遍:

  • 您的GitHub SSH設置
  • 網址myName/myRepo.git的確切大小寫(大寫/小寫)
  • 如果問題仍然存在,並帶有https網址

     git remote set-url origin https://github.com/myName/myRepo.git 

不確定OP是否解決了他的問題,但是對於將來的參考(因為這不久前對我有所幫助哈哈),問題在於SSH / OAuth授權。 我通過替換OAuth進行終端訪問並更新gitconfig文件解決了我的情況:

** OSX Sierra平台**

  1. 通過git config -e命令檢查您的配置文件。
  2. 打開您的鑰匙串應用程序。
  3. 搜索github.com || org.github.com(如果您在組織的企業倉庫中)。
  4. 選擇適用於github的鑰匙串條目-類型“ Internet密碼”。
  5. 通過粘貼OAuth密鑰來編輯密碼。
  6. 退出並重試以推送到您的存儲庫,該存儲庫將生成一個彈出窗口,要求鑰匙串訪問。
    • 如果是這樣,請允許訪問。
    • 如果不是,則您編輯了錯誤的鑰匙串,或者某些內容未正確保存。

Git在github上有大量的文檔記錄,因此,如果遇到麻煩,只需在其上進行快速搜索即可(或stackoverflow ...),希望它不會太難清除。 人們樂於助人,所以不要害怕問一個愚蠢的問題!

暫無
暫無

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

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