zoukankan      html  css  js  c++  java
  • 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用户名.sshid_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//查看已经提交的文件。

  • 相关阅读:
    滚动条 几中滚动方式
    <script id="nav_template" type="text/x-handlebars-template"> JS的模板引擎 Handlebars.js 模板引擎
    自定义滚动条插件 mCustomScrollbar 使用介绍
    javascript 返回上一页面:onclick="javascript:history.back(-1);"
    Git 2016视频教程
    jsp自定义标签
    PIE使IE浏览器支持CSS3属性(圆角、阴影、渐变)
    border-radius IE8兼容处理
    IE8浏览器总是无响应或卡死崩溃怎么办
    几何的简单操作
  • 原文地址:https://www.cnblogs.com/lanshanxiao/p/7237110.html
Copyright © 2011-2022 走看看