zoukankan      html  css  js  c++  java
  • 初次创建远程仓库并推送本地项目到远程仓库

    初次创建远程仓库并推送本地项目到远程仓库

    步骤

    管理员在远程创建仓库,有了远程仓库地址,但是没有代码。

    在本地搭建项目

    在项目中初始化仓库,并进行一次提交

    在本地添加远程仓库

    将本地代码推送到远程仓库

    在项目中初始化仓库,并进行一次提交

    1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization
    $ git init
    Initialized empty Git repository in C:/Users/1/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization/.git/
    

    添加远程仓库

    1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
    $ git remote add origin git@192.168.1.254:devops/teach_organization.git
    
    1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
    $ git remote -v
    origin  git@192.168.1.254:devops/teach_organization.git (fetch)
    origin  git@192.168.1.254:devops/teach_organization.git (push)
    

    将本地代码推送到远程仓库

    1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
    $ git push origin master
    Enumerating objects: 45, done.
    Counting objects: 100% (45/45), done.
    Delta compression using up to 6 threads
    Compressing objects: 100% (26/26), done.
    Writing objects: 100% (45/45), 54.74 KiB | 4.98 MiB/s, done.
    Total 45 (delta 1), reused 0 (delta 0)
    To 192.168.1.254:devops/teach_organization.git
     * [new branch]      master -> master
    

    查看全部分支

    1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
    $ git branch -a
    * master
      remotes/origin/master
    

    bugs

    如果本地git仓库一次提交都没有,则无法查看分支,也无法推送到远程仓库。

    1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
    $ git log
    fatal: your current branch 'master' does not have any commits yet
    
  • 相关阅读:
    jQuery中删除方法empty(),remove()和detach()的区别
    怎么设置font awesome图标的大小?
    什么是回调函数?
    MIP开发教程(三) 使用MIPCLI工具调试组件
    MIP开发教程(一) MIPCLI工具安装与环境部署
    MIP 2016年终总结
    MIP开发教程(二) 使用MIPCLI工具调试MIP网页
    VIP站长大会(北京站)常见问题解答
    MIP开发常见问题解答
    CMS模板应用调研问卷
  • 原文地址:https://www.cnblogs.com/mozq/p/11796220.html
Copyright © 2011-2022 走看看