一、远程仓库关联
1.设置全局的提交模板:
git config --global commit.template [模板文件名]
例如:git config --global commit.template git_template
2.设置文本编辑器:
git config --global core.editor [编辑器名称]
例如:git config --global core.editor vim
3.设置用户名及邮箱
git config --global user.name "xx.x"
gitconfig --global user.email "xx.x@xxx.com.cn"
4. 然后会生成.gitconfig文件,该文件在用户的主目录下,内容如下:
[core]
editor = vim
[commit]
template = /home/xxxx/git_template
[user]
email = xx.x@xxxx.com.cn
name = xx.x
5. 然后提交代码时, git add , git commit 后即可出现提交模板。
参考:https://blog.csdn.net/import_sadaharu/article/details/54576748
二、提交模板配置
1. 总体步骤:
- 创建本地仓库
- 初始化本地仓库
- 创建远程仓库
- 添加SSH Key(密钥传输)
- clone远程仓库,使本地仓库与远程仓库相关联 (git clone ssh://git@xx.xx.xx.xx/maser_name/branch_name.git)这里注意前边的ssh,注意这一条与参考文献中的说明不同。另外,有时需要加端口号:git clone ssh://git@xx.xx.xx.xx:port number/maser_name/branch_name.git
- 向远程仓库push本地仓库
2.参考:https://blog.csdn.net/qq_26012495/article/details/80503241