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了

  • 相关阅读:
    动态调用WCF服务
    矩阵的坐标变换(转)
    【.NET线程--进阶(一)】--线程方法详解
    [转] Location语法规则
    [转] 深入理解vue 一些底层原理
    [转] lodash常用方法
    [转] Vue 组件间通信六种方式(完整版)
    [转] vuejs组件通信精髓归纳
    [转] 浅谈移动端设备标识码:DeviceID、IMEI、IDFA、UDID和UUID
    [转] vue自定义组件中的v-model简单解释
  • 原文地址:https://www.cnblogs.com/lulin9501/p/11262275.html
Copyright © 2011-2022 走看看