github的提交源码到服务器

github是现代的代码库,各种牛人,各种开源,也是现在大公司招聘的一个考察点,

这里介绍一下怎样把本地源码提交到github上。

  首先我们需要在github上创建一个respository。

2,输入相关信息

4,在终端中进入到你的项目的文件夹,也即是你要提交的项目。

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/你的github的名字/刚才建的resposity的名字.git
git push -u origin master

这样就可以把项目提交到github上了,但是如果我们再次像提交一个项目的时候,

在输完指令后
git remote add origin https://github.com/你的github的名字/刚才建的resposity的名字.git

会提示:fatal: remote origin already exists

其实我们只要执行:就可以了,

git remote rm origin

 也即比上一次的指令多了一条这样的信息。我们就可以第二次提交源码了。

作者:Darren

微博:@IT_攻城师

出处:http://www.cnblogs.com/fengtengfei/

原文地址:https://www.cnblogs.com/fengtengfei/p/3969646.html