目录

Git 常见问题

unable to auto-detect email address

这个问题网上固定的解决方案是全局设置用户名和邮箱:

1
2
git config --global user.email "you@example.com"
git config --global user.name "Your Name"

其实这个问题也可以在提交时单独设置

1
git -c "user.name=Your Name" -c "user.email=Your email" commit "Your commit message"

指定私钥文件

1
GIT_SSH_COMMAND='ssh  -i "/data/flexcloud/vscode/.ssh/id_rsa"' git push origin master

are you sure you want to continue connecting

https://cdn.xiaobinqt.cn/xiaobinqt.io/20220712/73049793ae584d35b6812cc0ec0f318b.png?imageView2/0/q/75|watermark/2/text/eGlhb2JpbnF0/font/dmlqYXlh/fontsize/1000/fill/IzVDNUI1Qg==/dissolve/52/gravity/SouthEast/dx/15/dy/15

如何想要忽略这个提示,可以在终端中输入👇

1
GIT_SSH_COMMAND='ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no"' git push origin master

参考