当前位置: 移动技术网 > IT编程>开发语言>Java > git上传本地项目到github或者gitlib(两个是一样的)。

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

2019年08月01日  | 移动技术网IT编程  | 我要评论

第一步:在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

  

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网