• 新建git本地仓库关联远程仓库,无法推送。


    *问题描述
    今天建的一个工作日志文档,推送远程仓库不成功。
    *过程描述
    1.git init
    2.git remote add origin https://gitee.com/tylerGuo1/dailyRecord.git
    远程仓库不是使用ssh,竟然不报错,看来http和ssh两者效果一样。
    3.git add -A
    4.git commit -m "初始化"
    5.git push
    报错如下:
    fatal: The current branch master has no upstream branch.
    To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master  
    

    6.git push -u origin master
    提示需要先拉去,报错如下:
    To https://gitee.com/tylerGuo1/dailyRecord.git
    ! [rejected] master -> master (non-fast-forward)
    error: failed to push some refs to 'https://gitee.com/tylerGuo1/dailyRecord.gi
    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.
    7.git pull origin master
    报错如下:
    * branch master -> FETCH_HEAD
    fatal: refusing to merge unrelated histories
    8.git pull origin master -allow-unrelated-histories
    报错如下:
    fatal: couldn't find remote ref –allow-unrelated-histories
    9.git pull origin master --allow-unrelated-histories //成功。
    一直卡在问题8,后来发现是小了一个短杠,但其实中间有一次试错的时候用了两个短杠,后来又用就可以了。

  • 相关阅读:
    Day 9
    Day 8
    Day 7
    Day 6
    Day 5
    Day 4
    Day 3
    Day 2
    Day 1
    解决vue-cli3不停请求 /sockjs-node/info?t= 问题
  • 原文地址:https://www.cnblogs.com/guojuboke/p/10907248.html
Copyright © 2020-2023  润新知