git使用简易指南
http://www.bootcss.com/p/git-guide/
简单操作
更新远程仓库
1 | # 不会同步删除操作 |
更新本地仓库
但是更新后然后用上面方式更新会是merge到master而不是更新master
```bash
git pull 或者 git fetch origin master
1
2
3
4
5
6
7<h3 id="创建分支"><a href="#创建分支" class="headerlink" title="创建分支"></a>创建分支</h3>
```bash
git checkout -b iss53
# 上面的命令相当于
git branch iss53
git checkout iss53
删除分支
1 | git branch -d hotfix |
新建repository
目前用的最笨的手动创建repository,然后git clone到本地,然后往本地的文件夹添加文件,再push上去
问题集合
git push提示没有权限
设置Git的user name和email
```bash
git config --global user.name "yourname"
git config --global user.email "youremail"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23<p>生成SSH密钥<br>```bash
查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
生存密钥:
ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa和id_rsa.pub
```</p>
<p>添加密钥到ssh:ssh-add 文件名,需要之前输入密码.</p>
<p>在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。<br>打开<a href="https://github.com/,在设置中添加密钥" target="_blank" rel="noopener">https://github.com/,在设置中添加密钥</a></p>
```bash
测试:ssh git@github.com
The authenticity of host ‘github.com (207.97.227.239)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
如何修改github上仓库的项目语言?
问题原因:
github 是根据项目里文件数目最多的文件类型,识别项目类型.
解决办法:
项目根目录添加 .gitattributes 文件, 内容如下 :
1 | *.swift linguist-language=objective-c |