gitlab:提交模板配置-远程仓库关联

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 17:50   1735   0

一、远程仓库关联

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. 总体步骤:

  1. 创建本地仓库
  2. 初始化本地仓库
  3. 创建远程仓库
  4. 添加SSH Key(密钥传输)
  5. 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
  6. 向远程仓库push本地仓库

2.参考:https://blog.csdn.net/qq_26012495/article/details/80503241

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP