安裝並配置Git
1.Linux下安裝配置git
yum install git #使用yum安裝git
git config --global user.name "Your Name" #配置用戶名
git config --global user.email "[email protected]" #配置郵箱
git config --list #查看配置是否生效
ssh-keygen -t rsa -C "[email protected]" #生成ssh key 按三下回車就可以了
cat ~/.ssh/id_rsa.pub #查看生成的公匙
如果使用gitlab可能需要配置host(見文章末尾–其他相關)。
2.在github/gitlab上設置公匙,就可以正常使用了。
git常用命令
其他相關
- windows下Host文件位置
C:\Windows\System32\drivers\etc\hosts - Linux下Host文件位置
etc/hosts