在comma上推送到仓库的教程
一先生 • 9 小时前 • 13 次点击 •
✅ 一步到位修复(直接照做)
🚀 ① 生成 key(指定到正确目录)
mkdir -p /data/ssh
ssh-keygen -t ed25519 -f /data/ssh/id_ed25519 -C "1okko@comma"
ssh-keygen -t ed25519 -f /data/ssh/id_ed25519 -C "1okko@comma"
👉 一路回车(不要密码)
🚀 ② 设置权限(很重要)
chmod 700 /data/ssh
chmod 600 /data/ssh/id_ed25519
chmod 644 /data/ssh/id_ed25519.pub
chmod 600 /data/ssh/id_ed25519
chmod 644 /data/ssh/id_ed25519.pub
🚀 ③ 把公钥加到 GitHub
cat /data/ssh/id_ed25519.pub
复制输出,去 GitHub:
- Settings
- SSH and GPG keys
- New SSH key
粘进去保存
🚀 ④ 强制 SSH 使用这个 key
创建配置文件:
nano /data/ssh/config
写入:
Host github.com
HostName github.com
User git
IdentityFile /data/ssh/id_ed25519
HostName github.com
User git
IdentityFile /data/ssh/id_ed25519
然后:
chmod 600 /data/ssh/config
🚀 ⑤ 测试(关键一步)
ssh -i /data/ssh/id_ed25519 -T git@github.com
✅ 正确结果:
Hi 1okko! You've successfully authenticated
🚀 ⑥ 再 push
git push -f origin vw