前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )

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

作者头像
韩曙亮
发布2023-03-29 19:27:06
3550
发布2023-03-29 19:27:06
举报
文章被收录于专栏:韩曙亮的移动开发专栏

文章目录

一、报错信息


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

代码语言:javascript
复制
Push failed: Failed with error: Could not read from remote repository.
在这里插入图片描述
在这里插入图片描述

二、解决方案


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

在这里插入图片描述
在这里插入图片描述

考虑使用 Git 命令提交 ;

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

代码语言:javascript
复制
git push --set-upstream origin master

完整过程 :

代码语言:javascript
复制
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 可视化提交失败 , 可以考虑使用命令提交代码 ;

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-10-17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章目录
  • 一、报错信息
  • 二、解决方案
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档