zoukankan      html  css  js  c++  java
  • 推送本地项目至Github遇到的问题以及解决办法记录

    在把本地新项目推送至GitHub仓库时的大致流程和步骤,首先现在GitHub上面新建一个项目,复制该项目的 带.git 后缀的地址,比如

    git@github.com:XXX/XXX.git

    然后在本地项目上 git init 初始化一个仓库,然后 使用
    git add .
    git commit -m "commit message"
    git remote add origin git@github.com:XXX/XXX.git
    然后 git push -u origin master

    这时候可能会遇到

    (python36) [robert@Robert-MacBook-Pro robert-learn-python (master)]$ git push -u origin master
    To https://github.com/doublnt/robert-learn-python
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'https://github.com/doublnt/robert-learn-python'
    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.
    

    这时候你需要 git pull origin master

    但是这时你又会遇到

    (python36) [robert@Robert-MacBook-Pro robert-learn-python (master)]$ git pull
    fatal: refusing to merge unrelated histories
    

    这时你只需要

    git pull origin master --allow-unrelated-histories

    然后就可以直接 push 了

    git push origin master

  • 相关阅读:
    ABP-AsyncLocal的使用
    ABP-多个DbContext实现事物更新
    ABP取其精华
    VS2019和net core 3.0(整理不全,但是孰能生巧)
    consul部署多台Docker集群
    Arcgis runtime sdk .net 二次开发
    C# 依赖注入 & MEF
    自动构建环境搭建
    C# 调用C/C++动态链接库,结构体中的char*类型
    C# 调用C++DLL 类型转换
  • 原文地址:https://www.cnblogs.com/xiyin/p/7625293.html
Copyright © 2011-2022 走看看