Github/Gerrit用法备忘

配置SSH公钥访问Github

Github提供两种克隆URL:HTTPSSSH;HTTPS URL的PUSH等操作时需要验证用户名和密码;而使用SSH URL可以避免这种麻烦,但是在使用之前需要配置SSH KEY。

配置方法步骤如下:

  1. 配置git
$ git config --global user.name "fatdeer"
$ git config --global user.email "fatdeer@foxmail.com"
$ git config --list
> user.name=fatdeer
> user.email=fatdeer@foxmail.com
  1. 创建SSH KEY
$ ssh-keygen -t rsa -C "fatdeer@foxmail.com"

参考:创建SSH Key

  1. 在Github上配置SSH 公钥

参考:添加SSH Key到Github账户

  1. 验证
ssh -T git@github.com

添加/更新Submodule

git submodule add -b <branch> --force <repository_url> <path>

Sparse-Checkout

git clone --no-checkout <path>
git config core.sparsecheckout true
echo "path1/" >> .git/info/sparse-checkout
git checkout