... | @@ -16,38 +16,50 @@ echo "hello git" >> README.md |
... | @@ -16,38 +16,50 @@ echo "hello git" >> README.md |
|
git add .
|
|
git add .
|
|
git commit -m readme
|
|
git commit -m readme
|
|
```
|
|
```
|
|
2. 从服务端获取一个项目,类似 svn co
|
|
|
|
|
|
2. 设置公钥
|
|
|
|
|
|
|
|
windows用户使用git-bash 执行命令
|
|
|
|
|
|
|
|
```
|
|
|
|
ssh-keygen -t rsa
|
|
|
|
```
|
|
|
|
一路默认回车
|
|
|
|
然后进入用户目录的.ssh文件夹下,复制rsa.pub的内容 到gitlab的设置ssh-key的地方即可
|
|
|
|
|
|
|
|
3. 从服务端获取一个项目,类似 svn co
|
|
|
|
|
|
```
|
|
```
|
|
git clone git@tech.pingansec.com:wangqs/wiki-git.git
|
|
git clone git@tech.pingansec.com:wangqs/wiki-git.git
|
|
```
|
|
```
|
|
|
|
|
|
3. 将本地的代码推送到远程
|
|
4. 将本地的代码推送到远程
|
|
```
|
|
```
|
|
git push origin master
|
|
git push origin master
|
|
```
|
|
```
|
|
|
|
|
|
4. push 出现reject
|
|
5. push 出现reject
|
|
```
|
|
```
|
|
git pull --rebase origin master
|
|
git pull --rebase origin master
|
|
```
|
|
```
|
|
|
|
|
|
5. 更新代码
|
|
6. 更新代码
|
|
```
|
|
```
|
|
git pull --rebase origin master
|
|
git pull --rebase origin master
|
|
```
|
|
```
|
|
|
|
|
|
6. 把本地已存在的项目推送到远程
|
|
7. 把本地已存在的项目推送到远程
|
|
```
|
|
```
|
|
git remote add origin git@tech.pingansec.com:wangqs/wiki-git.git
|
|
git remote add origin git@tech.pingansec.com:wangqs/wiki-git.git
|
|
```
|
|
```
|
|
|
|
|
|
7. 创建分支,切换分支
|
|
8. 创建分支,切换分支
|
|
```
|
|
```
|
|
git branch issues999
|
|
git branch issues999
|
|
git checkout issue999
|
|
git checkout issue999
|
|
```
|
|
```
|
|
|
|
|
|
8. 切换远程分支到本地
|
|
9. 切换远程分支到本地
|
|
```
|
|
```
|
|
git fetch
|
|
git fetch
|
|
git checkout branchname
|
|
git checkout branchname
|
... | | ... | |