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. 在虚拟机安装Oracle,在本地电脑上运行sql develer出现ora-12514

    问题是解决了,先描述一下,本人用的虚拟机系统是server 2003 1.打开虚拟机,然后不管了 2.打开本地的sql developer,登录,出现了一个小白框:ora-12514:listener ...

  2. 训练1-V

    输入2个正整数A,B,求A与B的最大公约数. Input 2个数A,B,中间用空格隔开.(1<= A,B <= 10^9) Output 输出A与B的最大公约数. Sample Input ...

  3. CentOS 笔记(五) 常用工具

    远程 :XShell6  ,PuTTy FPT:Xfpt ,pscp.exe

  4. rtsp://admin:12345@192.168.1.198/mpeg4/main/ch01/av_stream

    rtsp://admin:12345@192.168.1.198/mpeg4/main/ch01/av_stream

  5. 【hihocoder 1032】最长回文子串

    [题目链接]:http://hihocoder.com/problemset/problem/1032 [题意] [题解] 原文地址:https://segmentfault.com/a/119000 ...

  6. 【codeforces 799A】Carrot Cakes

    [题目链接]:http://codeforces.com/contest/799/problem/A [题意] 你有一个烤炉; 每t秒能同时烤出k个蛋糕; 你可以在第一个烤炉在烤的时候;同时花费d秒建 ...

  7. C++ constexpr类型说明符

    本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/50864210 关键字 constexp ...

  8. js 现给数字加三位一逗号间隔的种方法

    方法一:(ie下有问题) <script type= "text/javascript"> var num_s = "1232134456.546 " ...

  9. JavaWeb应用中的身份验证(声明式)——基于表单的身份认证

    容器管理安全最普遍的类型建立在基于表单的身份验证方式上. 通过这样的方式,server自己主动将尚未验证的用户重定向到一个HTML表单.检查他们的username和password,决定他们属于哪个角 ...

  10. Android广播机制分析

    1.1. 广播简单介绍         Android 广播与生活中的广播概念不同,它是指系统中产生事件后的通知. Android 广播不关心接收者是否收到处理或者怎样处理广播,能够说是一种单向的通知 ...