已有项目创建git

  1. 1. 找到自己已有的项目文件夹下,空白处鼠标右键菜单中选择Git Bash Here

    git使用本地代码(已有项目)如何创建远程仓库
  2.  

    2. 在代码托管网站上面,创建一个新的仓库,并复制该仓库的地址

    git使用本地代码(已有项目)如何创建远程仓库
  3.  

    3. 回到步骤1中弹出的命令行窗口中,输入git init 后回车

    git使用本地代码(已有项目)如何创建远程仓库
  4.  

    4. 再输入如图所示的命令添加远程仓库的地址: git remote add origin 地址

    git使用本地代码(已有项目)如何创建远程仓库
  5.  

    5. 使用命令拉取master分支的代码: git pull origin master

    git使用本地代码(已有项目)如何创建远程仓库
  6.  

    6. 使用命令添加文件到git中去: git add .

    git使用本地代码(已有项目)如何创建远程仓库
  7.  

    7. 提交代码: git commit -m 'init'

    git使用本地代码(已有项目)如何创建远程仓库
  8.  

    8. 将本地已有的工程文件代码push到远端: git push -u origin master

    git使用本地代码(已有项目)如何创建远程仓库
  9.  

    9. 回到托管网站查看更新的代码显示如图所示

    git使用本地代码(已有项目)如何创建远程仓库
  10.  

    文章来源:https://jingyan.baidu.com/article/4b52d70240dc05bc5d774b09.html

原文地址:https://www.cnblogs.com/weiyiyong/p/13600872.html