Git推送到GitHub仓库失败

使用Git将文件推送至GitHub的远程仓库时,报错failed to push some refs to 'git@github.com:RocsSun/mytest.git'

Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git remote add origin git@github.com:RocsSun/mytest.gt Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git push -u origin master
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository. Please make sure you have the correct access rights
and the repository exists. Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git remote add origin git@github.com:RocsSun/mytest.git
fatal: remote origin already exists. Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git remote rm origin Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git remote add origin git@github.com:RocsSun/mytest.git Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git push -u origin master
To github.com:RocsSun/mytest.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:RocsSun/mytest.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details. Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git push origin master
To github.com:RocsSun/mytest.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:RocsSun/mytest.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details. Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git remote rm origin

大概原因就是 意思是本地和远程的文件应该合并后才能上传本地的新文件

1、先拉下来,会自动合并的(不用操心)

git pull origin master

2、再上传

git push -u origin master

成功解决问题

failed to push some refs to 'git@github.com:RocsSun/mytest.git的更多相关文章

  1. error: failed to push some refs to 'https://github.com/username/python.git'

    解决error: failed to push some refs to 'https://github.com/bluepen/python.git' 当我们在使用git工具上传我们自己的代码时,可 ...

  2. 错误:error: failed to push some refs to 'https://github.com/pzq7025/KG.git'的解决办法

    一.问题在进行[git push orgin master]的时候出现如下错误 ! [rejected] master -> master (non-fast-forward) error: f ...

  3. git上传文件夹报错: ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/taminachen/rjxm.git' hint: Updates were rejected because the remote contains work

    使用git上传本地文件夹到远程仓库,使用如下命令:git push -u origin master时报错 原因是在GitHub创建仓库时创建了readme文件,但是本地没有这个文件,造成本地目录与远 ...

  4. git 本地推送远程仓库报错: error: failed to push some refs to 'https://github.com/yangtuothink/mxonline.git'

    报错现象 添加远程仓库后 推送代码的时候报错 报错分析 远程代码和本地代码不匹配问题 远程初始仓库的创建有些默认 的 README什么的本地是没有的 需要先同步后再上传 报错解决 git push - ...

  5. git/github error: failed to push some refs to 'https://github.com/shenhaha/cloudletter.git'

    git 提交代码到github上报如下错误 报错分析: 解决方法: 关闭这两个设置 再次提交代码 success

  6. git 解决 error: failed to push some refs to 'https://github.com/xxxx.git'

    在github远程创建仓库后, 利用gitbash进行提交本地文件的时候出现如下错误 [root@foundation38 demo]# git push -u origin master Usern ...

  7. git 报错:error: failed to push some refs to 'https://github.com/Anderson-An/******.git'(已解决)

    提交push 报错: $ git push origin masterTo https://github.com/Anderson-An/******.git ! [rejected] master ...

  8. git push ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/Operater9/guest' hint: Updates were rejected because the tip of your current bra

    推送本地代码到github报错 git push报错 ! [rejected] master -> master (non-fast-forward) error: failed to push ...

  9. failed to push some refs to 'https://gitee.com/ftl_663/java-shop.git'

    1.git init 2.git add . 3.git commit  -m "init" 4.git remote add origin  https://gitee.com/ ...

随机推荐

  1. 关于配置websocket,nginx转发https至wss问题

    在本地测试通过的socket,再放到现在的有nginx代理之后发现会报:failed: Error in connection establishment: net::ERR_NAME_NOT_RES ...

  2. babel把ES6转化为ES5的时候报错

    Module not found: Error: Can't resolve '@babel/runtime/helpers/asyncToGenerator' in 'e:\Node.js\Node ...

  3. 训练1-C

    妈妈每天都要出去买菜,但是回来后,兜里的钱也懒得数一数,到底花了多少钱真是一笔糊涂帐.现在好了,作为好儿子(女儿)的你可以给她用程序算一下了,呵呵. Input 输入含有一些数据组,每组数据包括菜种( ...

  4. nyoj329-循环小数

    329-循环小数 内存限制:64MB时间限制:3000msSpecial Judge: No accepted:1submit:1 题目描述: 我们可爱的 c小加 近段儿正在潜心研究数学,当他学习到循 ...

  5. Win32 编程消息常量(C#)

    public class WinMessages { #region 基本消息 public const int WM_NULL = 0x0000; public const int WM_CREAT ...

  6. vue 动态获取div宽高有时候为0的情况

    项目背景: 需要使用echarts进行图表展示.由于div宽高是不固定的,因此需要先获取父级的宽高再把值赋予到图表的div中. 需要使用 this.$nextTick(() => {    }) ...

  7. 导入项目后下载jar包问题理解

    1.导入,然后你下载的jar包,jar下载成功,并不代表你项目里的代码就能用这个jar包了. 你必须还要本地添加进classpath.必须手动添加进类路径 2.总结就是:下载jar包是下载jar包,添 ...

  8. HDU 2054 A==B? 大数

    Problem Description Give you two numbers A and B, if A is equal to B, you should print "YES&quo ...

  9. Android SQLiteDatabase分析

    Android中的数据存储使用的小巧的SQLite数据库. 为了方便java层使用SQLite,android做了大量的封装.提供了一些列的类和API.本文章就揭露这些封装背后的类图关系. 老规矩,首 ...

  10. USACO 1.4 Mother's Milk

    Mother's Milk Farmer John has three milking buckets of capacity A, B, and C liters. Each of the numb ...