• 把本地已经存在的仓库推送到远程github上面


    把本地已经存在的仓库推送到远程github上面

    • 在本地初始化一个git仓库
      git init
    • 首先在在github新建一个仓库,可以获得一个url,建议设置成空的的仓库,没有(readme.md).(可能会与本地导致冲突,暂无测试过)
      git remote add origin url(https://github.com/Zidoing/python_standard_lib.git)
    • 推送本地文件到远程
      git push origin master

    期间可能遇到异常,因为你刚初始化的文件并未提交过所以,会有以下错误提示。
    需先git add and git commit -m "words"

    $ git push origin master
    error: src refspec master does not match any.
    error: failed to push some refs to 'https://github.com/Zidoing/python_standard_lib.git'
    

    》.git pull origin master --allow-unrelated-histories,这一句代码的意思将coding上面的仓库更新到本地,为什么呢,因为在coding创建项目的时候勾选了启用README.md文件进行初始化项目,所以准备就绪了过后,应该吧coding仓库里面的README.md文件放入本地来进行第一次本地与coding的传输。

  • 相关阅读:
    Day12 文件操作
    Day11 集合、集合操作
    Day10 【小程序】商城管理(购物车小程序的增强版)
    Day8 字符串操作
    Day9 字典操作
    文件操作
    【python练习】购物车程序
    2296 寻找道路
    2661 信息传递(tarjan&拓扑)
    【模板】LCA(tarjan)
  • 原文地址:https://www.cnblogs.com/Zidon/p/5993734.html
Copyright © 2020-2023  润新知