【Git】Git工具常用命令

GitHub使用指南

 

 

.把本地代码上传到GitHub

0. 提前配置好上传地址

git config --global user.name “username”】

git config --global user.email “your email”】

 

【查看用户名和邮箱】

$ git config user.name

$ git config user.email

 

1.在需要上传的根目录下初始化仓库 

cd  待上传目录】

【git init】 #  当后来再同步到github时,不需要本行命令

 

 

2.把当前目录中的所有文件加入

【git add .】

 

3.提交到仓库

git commit -m “dicription of this code..”】

 

4.上传到GitHub

git remote add origin https://github.com/maruitao/dw2-workspace.git   #不是每次备份都必须找个命令

注意此步骤只是和https://github.com/maruitao/dw2-workspace.git 链接上,代码并没有推送

 

5.推送代码

git push -u origin master

 

6.下载代码

cd  $HOME

git clone https:github.com/mrt..

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2018-03-10 13:11  Joshua王子  阅读(247)  评论(0编辑  收藏  举报