• git错误:error: failed to push some refs to 'https://...'


    [root@foundation38 demo]# git push -u origin master
    Username for 'https://github.com': xuefeilong
    Password for 'https://xuefeilong@github.com': 
    To https://github.com/xuefeilong/test.git
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'https://github.com/xuefeilong/test.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
    hint: before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    
    1: 进行push前先将远程仓库pull到本地仓库
    $ git pull origin master    #git pull --rebase origin master
    $ git push -u origin master
    
    2: 强制push本地仓库到远程 (这种情况不会进行merge, 强制push后远程文件可能会丢失 不建议使用此方法)
    $ git push -u origin master -f
    
    3: 避开解决冲突, 将本地文件暂时提交到远程新建的分支中
    $ git branch [name]
    # 创建完branch后, 再进行push
    $ git push -u origin [name] 
    
  • 相关阅读:
    算法:二分图最大独立集
    算法:桶排序
    算法:二分图最小点覆盖——Konig定理
    jQuery基础整理之思维导图
    vue基础知识整理
    HTML总结
    JAVAScript总结
    栈和队列
    今日学习遇到的问题(2018.9.23)
    看了vue文档之后。。。。
  • 原文地址:https://www.cnblogs.com/shuchengyi/p/11937219.html
Copyright © 2020-2023  润新知