第一个问题:怎么也不能将自己本地仓库代码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//查看已经提交的文件。

Git错误解决(windows版本下的Git Shell)的更多相关文章

  1. 【经验之谈】Git使用之Windows环境下配置

    前言 安装 配置 关于git使用的几个问题 后记 关于代码托管,以前用过vss和svn,看博客或论坛的时候,经常有人提到github,有很多著名的开源软件都托管在github,想来肯定不错(莫笑),当 ...

  2. (转)【经验之谈】Git使用之Windows环境下配置

    原文地址:http://www.cnblogs.com/xishuai/p/3590434.html 前言 安装 配置 关于git使用的几个问题 后记 关于代码托管,以前用过vss和svn,看博客或论 ...

  3. Windows操作系统下搭建Git服务器和客户端。

    本文将介绍如何在Windows操作系统下搭建Git服务器和客户端.服务器端采用的是Bonobo Git Server,一款用ASP.NET MVC开发的Git源代码管理工具,界面简洁,基于Web方式配 ...

  4. Android 源码获取-----在Windows环境下通过Git得到Android源代码

    在学习Android的过程中,深入其源代码研究对我们来说是非常重要的,这里将介绍如何通过在Windows环境下使用Git来得到我们的Android源代码. 1.首先确保你电脑上安装了Git,这个通过  ...

  5. (转发)Android 源码获取-----在Windows环境下通过Git得到Android源代码

    在学习Android的过程中,深入其源代码研究对我们来说是非常重要的,这里将介绍如何通过在Windows环境下使用Git来得到我们的Android源代码. 1.首先确保你电脑上安装了Git,这个通过  ...

  6. windows环境下使用git客户端、github和tortoisegit管理项目代码

    一.为什么 为什么不用svn? svn是一个优秀的代码和版本管理工具,使用svn只需要搭建好svn中央仓库,配置本地svn客户端即可,自从google code关闭服务之后,互联网上已经没有非常好的公 ...

  7. Windows平台下搭建Git服务器的图文教程

    Git没有客户端服务器端的概念,但是要共享Git仓库,就需要用到SSH协议(FTP , HTTPS , SFTP等协议也能实现Git共享,此文档不讨论),但是SSH有客户端服务器端,所以在window ...

  8. Windows平台下搭建Git服务器的图文教程(转发)

    Git没有客户端服务器端的概念,但是要共享Git仓库,就需要用到SSH协议(FTP , HTTPS , SFTP等协议也能实现Git共享,此文档不讨论),但是SSH有客户端服务器端,所以在window ...

  9. Windows环境下通过Git来管理自己的Android代码

    前面已经介绍了在Windows下使用git工具来下载Android的源代码,Windows环境下通过Git得到Android源代码,这里记录我使用git工具来管理我自己的代码,git是一种分布式的项目 ...

随机推荐

  1. 【redis基础】

    基础知识 http://www.runoob.com/redis/redis-partitioning.html redis性能分析 https://www.cnblogs.com/mushroom/ ...

  2. Linux系统查找清理磁盘大文件方法

    本文主要介绍Linux系统磁盘使用空间不足时,如何查找大文件并进行清理的方法. 下午使用df-h检查一台服务器磁盘使用空间,发现磁盘已经使用了100%,其中/dev/mapper/vg_iavp-lv ...

  3. AlvinZH掉坑系列讲解(背包DP大作战H~M)

    本文由AlvinZH所写,欢迎学习引用,如有错误或更优化方法,欢迎讨论,联系方式QQ:1329284394. 前言 动态规划(Dynamic Programming),是一个神奇的东西.DP只能意会, ...

  4. 分享到QQ空间和新浪微博功能

    分享到QQ空间 http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=http://campus.51job.com/cmbnt ...

  5. 6. Javscript学习笔记——BOM

    6. BOM 6.1 widow对象 全局作用域: window是浏览器的一个实例 window对象同时扮演着ECMAScript中的Global对象的角色,因此所有在全局作用域中声明的变量.函数都会 ...

  6. 牛客练习赛28-B(线段树,区间更新)

    牛客练习赛28 - B 传送门 题目 qn姐姐最好了~ ​ qn姐姐给你了一个长度为n的序列还有m次操作让你玩, ​ 1 l r 询问区间[l,r]内的元素和 ​ 2 l r 询问区间[l,r]内的 ...

  7. centos 7 设置开机启动服务

    2018-12-25 Centos7下添加开机自启动脚本和服务的方法 以docker 服务为例 1.centos7自带命令设置 systemctl enable docker.service 2.设置 ...

  8. AWS S3

    Amazon Simple Storage Service (Amazon S3) Amazon S3 提供了一个简单 Web 服务接口,可用于随时在 Web 上的任何位置存储和检索任何数量的数据.此 ...

  9. shell map使用

    # 定义初始化map declare -A map=([") # 输出所有key echo ${map[@]} # 输出key对应的值 "]} # 遍历map for key in ...

  10. 分分钟钟学会Python -基础&运算符

    day002 基础&运算符 1.循环语句 ### 1.循环格式 while 条件: print('') ''' while True: print('人生苦短,我用Python.') ''' ...