Git SSH key 生成
git config --global user.name "xxx"
git config --global user.email "xxxx@126.com"
ssh-keygen -t rsa -C "xxxx@126.com"
生成key之后,将
mkdir test
cd test
git init
git remote add origin git@xxxxx.git
git pull
du -h
git merge origin/master
常见问题1:use something like the following in your configuration file
如果提示如下信息
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "master"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
则可以进行如下设置
vim .git/config
设置的内容为:
[branch "master"]
remote = origin
merge = refs/heads/master
常见问题2:SSH - GitLab: Deploy keys are not allowed to push code. fatal: Could not read from remote repository
Gitlab中有两种key,
* deploy key:只读。只能pull,不能push代码到服务器端。Project=>Deploy Keys,在需要部署的某个project的setting中
* SSH key:可读可写。如果需要Push, 应该添加SSH key。Profile setting=> SSH Keys
常见问题3:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
原因是.git/config配置的文件传输方式是http方式,换成ssh方式进行文件传输即可
[remote "origin"]
url = https://xxxx.xx.git
改成
[remote "origin"]
url = git@git://xxxx.xx.git
持续更新…