Git常用命令与常识

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

持续更新…

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值