错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )(代码

Posted 韩曙亮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )(代码相关的知识,希望对你有一定的参考价值。





一、报错信息



android Studio 中首次向 GitHub 提交代码 , 报错 :

Push failed: Failed with error: Could not read from remote repository.





二、解决方案



如果在 Android Studio 中使用可视化界面提交失败 ;

考虑使用 Git 命令提交 ;

进入 Terminal 面板 , 进入工程根目录 , 执行如下命令 , 即可向 GitHub 提交代码 ;

git push --set-upstream origin master

完整过程 :

Microsoft Windows [版本 10.0.19041.1288]
(c) Microsoft Corporation。保留所有权利。

Y:\\002_WorkSpace\\001_AS\\VA_Original\\VirtualApp-master\\VirtualApp>git status
On branch master
nothing to commit, working tree clean

Y:\\002_WorkSpace\\001_AS\\VA_Original\\VirtualApp-master\\VirtualApp>git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


Y:\\002_WorkSpace\\001_AS\\VA_Original\\VirtualApp-master\\VirtualApp>git push --set-upstream origin master
The authenticity of host 'github.com (52.74.223.119)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.
Enumerating objects: 1239, done.
Counting objects: 100% (1239/1239), done.
Delta compression using up to 12 threads
Compressing objects: 100% (1156/1156), done.
Writing objects: 100% (1239/1239), 1.90 MiB | 908.00 KiB/s, done.
Total 1239 (delta 213), reused 0 (delta 0)
remote: Resolving deltas: 100% (213/213), done.
To github.com:han1202012/VirtualApp.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

Y:\\002_WorkSpace\\001_AS\\VA_Original\\VirtualApp-master\\VirtualApp>

GitHub 显示代码提交完成 ;

UI 可视化提交失败 , 可以考虑使用命令提交代码 ;

以上是关于错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )(代码的主要内容,如果未能解决你的问题,请参考以下文章

错误记录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 编译信息输出乱码

使用 logcat Android Studio 记录错误

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段