zoukankan      html  css  js  c++  java
  • git 新建仓库第一次提交

    1 . git init //初始化仓库,在初始化的目录中会出现.git的文件

    2. git add .(文件name) //添加文件到本地仓
     
    3. git commit -m "first commit" //添加文件描述信息,越详细越好
     
    4. git remote add origin + 远程仓库地址 //链接远程仓库,创建主分支
     
    5. git push -u origin master //把本地仓库的master的文件推送到远程仓库
    提交之后输入用户名密码后就会出现以下错误
    To https://gitee.com/lulin-oldboy/devops.git
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'url'
    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 merge the remote changes (e.g.,
    hint: 'git pull') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    想解决以上错误,只需要在4,5之间使用git pull origin master即可

    1. git init //初始化仓库
    2. git add .(文件name) //添加文件到本地仓库
    3. git commit -m "first commit" //添加文件描述信息越详细越好
    4. git remote add origin + 远程仓库地址 //链接远程仓库,创建主分支
    5. git pull origin master // 把本地仓库的变化连接到远程仓库主分支
    git 出现 fatal: refusing to merge unrelated histories 错误

     git pull origin master --allow-unrelated-histories

    6. git push -u origin master //把本地仓库的文件推送到远程仓库

     问题解决,可以正常使用git了

  • 相关阅读:
    2013-8-14大一大二暑期组队训练赛
    注重实效的程序员——哲学篇
    读《企业应用架构模式》-锁
    OpenCV 编码样式指南
    Offer_1
    μC/OS学习资料(附Ebook)
    poj 1990
    POJ 2455 网络流 基础题 二分+网络流 dicnic 以及 sap算法
    ViewPageAsImage
    win7下wordPress本地搭建博客详解(深度亲测整理---傻瓜式详细教程)
  • 原文地址:https://www.cnblogs.com/lulin9501/p/11262275.html
Copyright © 2011-2022 走看看