Linux创建SSH密钥,以供GIT使用
手动创建ssh文件夹mkdir -p ~/.ssh修改文件夹权限C++hmod&nb...

手动创建ssh文件夹

Bash
mkdir -p ~/.ssh

修改文件夹权限

Bash
chmod 700 ~/.ssh

创建ssh密钥

Bash
ssh-keygen -t ed25519 -C "your_email@example.com" -f ~/.ssh/id_ed25519

具体操作如下:


(可选)创建备用密钥

Bash
ssh-keygen -t rsa -b 4096 -C "your_email@example.com" -f ~/.ssh/id_rsa

修改文件权限

Bash
chmod 600 ~/.ssh/id_*chmod 644 ~/.ssh/*.pub

查看密钥内容

Bash
cat ~/.ssh/id_ed25519.pub

将密钥添加到Git服务器的SSH密钥管理列表


测试连接

Bash
ssh -T -p 8888 git@8.8.8.8

检查远程Git仓库的分支列表

Bash
git ls-remote --heads origin

d9bab494d0ce561696cea1401d22725c_202506081749348991312717.png