Ubuntu下git的安装与使用

安装:

sudo apt-get install git

配置:

git config --global user.name "你的Git用户名"
git config --global user.email "你的邮箱地址"

创建公钥:

Git生成SSH公钥

使用:

初始化git环境

git init

关联Git仓库

git remote add origin https://github.com/InkyTea/xxx.git

将Git仓库代码拉取到本地

git pull origin master

将本地代码推送到Git仓库

git push origin master

常用命令:

1
2
3
4
5
6
7
8
9
10
11
12
#查看没有跟踪的文件
git status
#添加版本控制文件
git add xxx
#文件提交到本地仓库
git commit -am "massage"
#移除版本控制文件
git rm -r --cached xxx/
#提交到Github远程仓库
git push -u origin master
#移除关联Git仓库
git remote rm origin

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!