将本地文件上传至github

第一步:

  在本地创建个文件夹

  比如:名字叫my-react

  

第二步:

  打开终端输入命令进入到my-react文件夹中,然后输入  git init

第三步:

  连接远程仓库,也就是连接Github 

   详细步骤请移步https://www.cnblogs.com/zshno1/p/11377418.html

第四步:

  创建github储存库

  

  

第五步:

  在Github上创建好Git仓库之后我们就可以和本地仓库进行关联了,根据创建好的Git仓库页面的提示,可以在本地my-react仓库的命令行输入:

  $ git remote add origin git@github.com:zshno1/my-react.git 

  ps:假如你是复制过来的文件可能已经有git地址了,比如你执行完上面的代码给你报错如下:

  fatal: remote origin already exists.

  碰到这种情况了,当然是删除已有的git地址了。命令如下:

 

   $ git remote rm origin 

 

 

第六步:

  上传文件

  在终端输入命令

   $ git add .  

   $ git commit -m '注释'  

     $ git push -u origin master  

  大功告成,搞定

原文地址:https://www.cnblogs.com/zshno1/p/11394453.html