从本地提交项目到github上

初学如何提交本地项目,因为容易忘记,所以记录下来。 

(该提交已经经过版本库的创建并与远程库已经关联)

1. 首先配置信息

    $ git config –global user.name “Your Name”

    $ git config –global user.email “email@example.com”
2. 链接到远程仓库 git remote add

    $git remote add origin git@github.com:(你的github地址)/gitdemo(项目名).git

若不记得你的远程库名,可以先用下面语句查看你的远程库:

$ git remote -v

若提示出错信息: 

fatal: remote origin already exists. 

解决办法: 

先输入:

$git remote rm origin

再输入:

$git remote add origin git@github.com:(你的github地址)/gitdemo(项目名).git

3、添加全部修改或新增文件

$git add .

4、提交更新

$git commit -m ‘注释信息’

5、将本地项目更新到github项目上

$git push -u origin master

若想克隆别人的库,直接输入

$git clone 项目地址

欢迎分享本文,转载请保留出处:前端ABC » 从本地提交项目到github上

分享到:更多 ()

发表评论 0