• git push -u orrgin master错误解决


    错误提示为:

    To github.com:PorterLi/myDataStructCode.git
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'git@github.com:PorterLi/myDataStructCode.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 命令合并两个仓库。

    解决方法:
    1.先利用git add 和git commit 将本地暂存区的内容添加到仓库
    2.git status 查看本地仓库内容,如下则可进行第三步

    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    nothing to commit, working tree clean
    

    3.命令如下,合并两个仓库。

    git pull --rebase origin master
    
  • 相关阅读:
    【BZOJ1015】星球大战starwar
    【BZOJ1878】HH的项链
    【BZOJ1012】最大数maxnumber
    【BZOJ3767】A+B Problem加强版
    【BZOJ1406】密码箱
    【BZOJ1067】降雨量
    【BZOJ1305】dance跳舞
    【BZOJ1509】逃学的小孩
    【BZOJ1103】大都市meg
    【BZOJ3262】陌上花开
  • 原文地址:https://www.cnblogs.com/dindin1995/p/13059166.html
Copyright © 2020-2023  润新知