git上传本地项目到github或者gitlib(两个是一样的)。

第一步:在github上面创建一个repository 

 点击create就好了。然后会出现下面的页面。

第三步:打开你所在文件夹,或者是新建的文件夹(用来做仓库的)右键会出现下面  选用git Bash Here 命令行执行。

点击以后出现下面图片

然后就是使用刚才我们在github上面创建的仓库 依次执行下面的代码。。。下面是两种形式。(空仓库、项目所在仓库)

create a new repository on the command line

echo "# project" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin 这里是自己的链接
git push -u origin master

 push an existing repository from the command line

git remote add origin 自己创建的repository链接
git push -u origin master

 本人用的是第二种比较方便:

遇到问题分享一下:

  remote origin already exists.

 解决方法:

  

先删除远程Git仓库用 $ git remote rm origin

  

原文地址:https://www.cnblogs.com/flyingDragon/p/11283151.html