【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )
生活随笔
收集整理的這篇文章主要介紹了
【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 一、報錯信息
- 二、解決方案
一、報錯信息
在 Android Studio 中首次向 GitHub 提交代碼 , 報錯 :
Push failed: Failed with error: Could not read from remote repository.二、解決方案
將 設置中的 Git 的 SSH executable 設置為 Native ;
打開 Git 安裝目錄下的 bin/bash , 在命令行中輸入
ssh-keygen -t rsa -C "han1202012"其中 han1202012 是 GitHub 賬號 ;
點擊 333 次回車 ;
octopus@DESKTOP-0EUIENB MINGW64 /bin $ ssh-keygen -t rsa -C "han1202012" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/octop/.ssh/id_rsa): Created directory '/c/Users/octop/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/octop/.ssh/id_rsa. Your public key has been saved in /c/Users/octop/.ssh/id_rsa.pub. The key fingerprint is: SHA256:pklRhEXgBzBDx3+zYponKSlrK7JsAPTncT78O6hGp4A han1202012 The key's randomart image is: +---[RSA 3072]----+ | .=o+*= | | . =oo | |. . o.. | |. . o +. o | |. . o * S. o | |.E . + Oo . | |. o.==+. | |+.o oo=..o | |+=o+.o.o .o | +----[SHA256]-----+octopus@DESKTOP-0EUIENB MINGW64 /bin $進入 C:\Users\octop\.ssh 目錄 , 需要使用 id_rsa.pub 中的內容 ;
C:\Users\octop.ssh\id_rsa.pub 文件的內容為 :
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDl+Ph2KiYOx3ABXGowLzB8Mb4uz7NcEaK0xfxzeTb173QWjSNC0H61nkP1aZX94A2r83kO1dIHoHSwxalGRLh6wL9vUJUq/XqvLGxUjcPDTVgztU/RR9Sw2aVFTPE9nWcZHvysnC3ST37iRMj+kUc2eWZ15UjgUZ+5xNh+e5kh80JAtJrJTSmyeyTI42UllGmDtVK0QWZAIylIcB2pS2vUDbrQFDtJOfIF6GvTReTWxQNH611TaQ+bIQpm9PgIcodO/vAWqer7i8xGv0BRObdUsl7ACq3FJOFuLsOqeR5DJVdgMcInP+tHO6dPFrQ6kX24a9oixpkOKaqK/rb7cH0xqUR0mlxtSe2EavnfmDhK1ejesbSYPH93Den92izhrW212fQMtKGrIxon1aaaRuIZnO1uccOzbfAnSz7F9SiyqAPvY03TlotHTlbMsTRPtjlNj6A4sxT9WbxdbZjanPplfgVhps1GLno3l91XZNXXO/Nq+VejK00ktUa5dbWQDi0= han1202012進入到 GitHub 中 ;
進入提交錯誤的工程的額 Settings 選項 ;
選擇 Deploy Keys 選項卡 , 然后點擊 " Add deploy key " 按鈕 ;
將 C:\Users\octop.ssh\id_rsa.pub 文件的內容拷貝到 Key 中 ;
設置完畢 ;
總結
以上是生活随笔為你收集整理的【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Android 插件化】Virtual
- 下一篇: 【错误记录】Android Studio