关于GitHub的使用命令

在GitHub使用过程中,避免不了用到Git命令,现记录一些日常使用的命令以便后期使用;


#配置 Git 的用户名、邮箱、秘钥、公钥

git config --global user.name "用户名"
git config --global user.email "邮箱"
ssh-keygen -t rsa -C "邮箱"
cat ~/.ssh/id_rsa.pub

 


#验证配置是否正常连接GitHub

ssh -T git@github.com

 


#克隆仓库时指定标签

git clone --branch <tag_name> <仓库URL>

例如:

git clone --branch v2.1.0 https://github.com/user/repo.git

注意:--branch 参数同时支持分支和标签名称

#包含子模块一起Git到本地

git clone --recurse-submodules https://github.com/user/repo.git

#还有和--branch 参数同时使用

git clone --recurse-submodules --branch v2.1.0 https://github.com/user/repo.git
阅读剩余
THE END