分类 git使用小技巧 下的文章

git 报 fatal: LF would be replaced by CRLF 错误

关于autocrlf文档原文: Set to true if you want to have CRLF line endings in your working directory and the repository has LF line endings. This variable can be set to input, in which case no output conversion is performed

AutoCRLF

#提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true

#提交时转换为LF,检出时不转换
git config --global core.autocrlf input

#提交检出均不转换
git config --global core.autocrlf false

SafeCRLF

#拒绝提交包含混合换行符的文件
git config --global core.safecrlf true

#允许提交包含混合换行符的文件
git config --global core.safecrlf false

#提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn

git配置SSH免密码登录

生成密钥对

ssh-keygen -t rsa -C "youremail@example.com"

远程主机git用户配置密钥

mkdir /home/git/.ssh
touch /home/git/.ssh/authorized_keys
cat 本机密钥 >> /home/git/.ssh/authorized_keys

修改文件权限

修改 .ssh 目录的权限为 700
修改 .ssh/authorized_keys 文件的权限为 600