LuoSong
LuoSong
Published on 2023-09-16 / 27 Visits
0
0

Git安装配置

Git安装配置

apt-get install git # 安装Git
git --version # 安装成功后显示版本 git version 2.34.1
git config --global user.name "name" # 配置用户名
git config --global user.email "email" # 配置用户邮箱
git config --list # 查看全局配置
ssh-keygen -t rsa -C email # 生成ssh-key 目录root/.ssh/id_rsa.pub

到Github添加ssh-key 头像->settings->SSH and GPG keys->New SSH key

2b60807b8d1a4d1abe8681c92124e18f.png59d9acbfee7049f083da188f3733c20a.png416dce7353bc48eab680f9cc20a173f4.png

测试链接

cd root/.ssh
vim config # 写入以下内容
--
Host github.com
User jeniluo@163.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
--
ssh -T git@girhub.com # 测试链接
You've successfully authenticated, but GitHub does not provide shell access. # 成功

Comment