git--版本工具的配置及报错信息处理

来源:互联网 发布:java web kettle 编辑:程序博客网 时间:2024/06/03 10:54

git
git
git

特别声明:可能因为博客编辑器的问题不能实现两个“- -”所以在中间加入了空格。复制粘贴命令时需要把“- -”中的空格删除

例如:git config - -global user.name “yourName” 需要删除空格

验证命令

安装后执行: git version

返回版本信息,则安装成功

一·基础配置

1.配置用户名(提交时会引用)

git config - -global user.name “yourName”

2.配置用户名(提交时会引用)

git config - -global user.email “yourEmail”

3.其他配置

如果安装KDiff3工具时,使用此配置:

git config - -global mergo.tool “kdif3”

使Git忽略Windows/Unix换行转换符

git config - -global core.autocrlf false

二·编码配置

1.避免git gui中的中文乱码

git config - -global gui.encoding utf -8

2.避免执行git status命令,显示中文文件名乱码

git config - -global core.quotepath off

3.忽略大小写(在Windows上需要配置)

git config - -global core.ignorecase false

三·配置公钥(git ssh key pair 配置)

1.生成ssh key pair

ssh-keygen -t rsa -C “yourEmail”

然后一路回车,不要输入任何内容,生成ssh key pair

2.添加公钥

ssh-add ~/.ssh/id_rsa

如果出现报错执信息:Could not open a connection to your authentication agent. 执行下方命令

eval ‘ssh-agent’ (‘ ’ 是~键上的`)
然后再执行上方命令

3.查看公钥,复制公钥

cat ~/.ssh/id_rsa.pub

4.把公钥,配置到远程仓库上

使用的网站不同配置方式稍有差异,基本类似。

出现以下报错信息,说明公钥,配置到远程仓库上失败。重点检查公钥是否配置在用户下而不是项目下

Access denied
exec request failed on channel 0
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

原创粉丝点击