zoukankan      html  css  js  c++  java
  • git在使用push指令的时候产生的错误

    一、问题
    我们在使用git指令的时候往往会出现如下错误。

    $ git push -u origin master
    To https://github.com/pzq7025/ss-fly.git
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'https://github.com/pzq7025/ss-fly.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文件中没有README.md的文件,因此需要用指令【git pull --rebase origin master】先拉取GitHub中的文件,在用【git push origin master】完成上传,除此之外指令【git push -u origin master】可以将空项目完成上传。
    【注:如果但前目录下面有README.md文件下来也会有问题,应删除当前目录下的文件。】


    三、结果
    这样就完成了本地到GitHub的内容上传


    四、总结
    git在刚开始使用的时候会遇到很多问题,但是基本的思想就是:
    1.用指令【ssh-keygen -t  rsa -C "注册邮箱"】建立秘钥
    2.将秘钥和GitHub连接
    3.创建本地git【git init】
    4.获取连接对象【git remote add origin [git的https位置]】

    5.完成git上传【git push origin  master】

  • 相关阅读:
    ArcEngine 一些实现代码(转载)
    关于GIS支持的地理数据源的命名空间
    SpringBoot-Web配置
    RedisGeo
    JedisCluster
    Java并发编程:Lock
    java并发编程:线程变量-ThreadLocal类
    java并发编程:线程池-Executors
    解决Mybatis配置ORM映射 时分秒都为0
    Kafka的存储机制以及可靠性
  • 原文地址:https://www.cnblogs.com/future-dream/p/11027319.html
Copyright © 2011-2022 走看看