当前位置: 首页 > news >正文

Git错误解决(windows版本下的Git Shell)

第一个问题:怎么也不能将自己本地仓库代码pull到GitHub网站上?

git push origin master

Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
To github.com:lanshanxiao/yunweather.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:lanshanxiao/yunweather.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.

 

 git pull origin master

Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
warning: no common commits
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From github.com:lanshanxiao/yunweather
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
fatal: refusing to merge unrelated histories

 

 git push origin master

Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
To github.com:lanshanxiao/yunweather.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:lanshanxiao/yunweather.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

以上执行了三次,但是都报错,虽然pull下来远程仓库的代码,但是没有 

git pull origin master//将本地仓库代码和远程仓库代码融合

如果有下面的报错:

fatal: refusing to merge unrelated histories//说明本地仓库不能和远程仓库代码融合

就强制允许融合:

git pull origin master --allow-unrelated-histories

 

第二个问题:尽管已经添加了SSH密码到GitHub上,但是还是会出现Permission denied (publickey)?你可能没有将公钥添加到本机上

Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

首先,按照百度上的解决步骤,将SSH密码(C:\Users\用户名\.ssh\id_rsa.pub)中的密码加到自己的GitHub网站上,这个可以百度。

再次运行git push origin master 还是出现上面的错误,接下来就是重点:

ssh-agent.exe//运行agent

ssh -vT git@github.com

ssh-add -l//小写字母L

ssh-add

ssh-add -l//小写字母L

上面命令是将ssh运行在本机,并将公钥添加进来。

 

git ls-files//查看已经提交的文件。

转载于:https://www.cnblogs.com/lanshanxiao/p/7237110.html

相关文章:

  • Sublime Text3快捷键
  • exports 和 module.exports 的区别
  • C#内存流示例-----用内存流来读取图片
  • dinic(当前最优模板)
  • tomcat catalina.sh JAVA_OPTS参数说明与配置
  • Hibernate学习10——Hibernate 查询方式
  • 2014年24段魔尺变球视频教程(升级版)
  • 九大内置对象
  • 测试用例编写(功能测试框架)
  • linux(centos)下安装PHP的PDO扩展
  • [C和指针].(美)Kenneth.A.Reek(ED2000.COM)pdf
  • 深度学习之Matlab 转C++在iOS上測试CNN手型识别
  • C++中struct和class的区别
  • Socket网络编程实例2
  • Oracle查询锁表和解锁
  • 「前端早读君006」移动开发必备:那些玩转H5的小技巧
  • 【跃迁之路】【669天】程序员高效学习方法论探索系列(实验阶段426-2018.12.13)...
  • 【跃迁之路】【699天】程序员高效学习方法论探索系列(实验阶段456-2019.1.19)...
  • ES6 学习笔记(一)let,const和解构赋值
  • Java 网络编程(2):UDP 的使用
  • mongodb--安装和初步使用教程
  • MYSQL如何对数据进行自动化升级--以如果某数据表存在并且某字段不存在时则执行更新操作为例...
  • nfs客户端进程变D,延伸linux的lock
  • Phpstorm怎样批量删除空行?
  • SpringBoot 实战 (三) | 配置文件详解
  • Sublime Text 2/3 绑定Eclipse快捷键
  • vue:响应原理
  • Web设计流程优化:网页效果图设计新思路
  • 世界编程语言排行榜2008年06月(ActionScript 挺进20强)
  • 它承受着该等级不该有的简单, leetcode 564 寻找最近的回文数
  • 想写好前端,先练好内功
  • 小程序开发之路(一)
  • 摩拜创始人胡玮炜也彻底离开了,共享单车行业还有未来吗? ...
  • ​LeetCode解法汇总2670. 找出不同元素数目差数组
  • #pragma multi_compile #pragma shader_feature
  • #Z2294. 打印树的直径
  • (AtCoder Beginner Contest 340) -- F - S = 1 -- 题解
  • (LeetCode 49)Anagrams
  • (Matalb分类预测)GA-BP遗传算法优化BP神经网络的多维分类预测
  • (八)Docker网络跨主机通讯vxlan和vlan
  • (附源码)ssm旅游企业财务管理系统 毕业设计 102100
  • (每日持续更新)jdk api之FileFilter基础、应用、实战
  • (一)pytest自动化测试框架之生成测试报告(mac系统)
  • (一)Spring Cloud 直击微服务作用、架构应用、hystrix降级
  • (原創) 物件導向與老子思想 (OO)
  • (转) Android中ViewStub组件使用
  • (转)负载均衡,回话保持,cookie
  • ..thread“main“ com.fasterxml.jackson.databind.JsonMappingException: Jackson version is too old 2.3.1
  • .net CHARTING图表控件下载地址
  • .Net Core/.Net6/.Net8 ,启动配置/Program.cs 配置
  • .NET 中选择合适的文件打开模式(CreateNew, Create, Open, OpenOrCreate, Truncate, Append)
  • .NET教程 - 字符串 编码 正则表达式(String Encoding Regular Express)
  • .NET值类型变量“活”在哪?
  • [ JavaScript ] JSON方法
  • [1181]linux两台服务器之间传输文件和文件夹