git 环境搭建

1. 生成ssh-key 并上传到 git服务器上

#cd $HOME

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

-t 是类型,-C 是注释

这样就会在/$HOME/.ssh 生成ssh-key,然后我们将生成的公钥id_rsa.pub 粘贴到git服务器上就可以了。

2. 如果出现如下错误,可以配置:

 可以在~/.ssh目录下面,新建一个config文件。里面这样写:
Host *
KexAlgorithms +diffie-hellman-group1-sha1

3. 配置gitLog模板。

cd ~

touch .gitCommit

git config --global  commit.template   ~/.gitCommit

执行git config -l,可以看到多了一行commit.template=~/.gitmessage 的信息
当提交代码时,执行git commit 
这时就会出现交互提交模板,照既定的格式填写必要的内容保存就可以了。

4. 另外 ,git config 可以配置好多内容,通过 git config --list 可以查看到很多配置项

git config --global user.name "name"

git config --global user.email  "email"

git config --global  core.editor vi

原文地址:https://www.cnblogs.com/jyfyonghu/p/10491826.html