gitlab:提交模板配置-遠程倉庫關聯

一、遠程倉庫關聯

 

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 "[email protected]"

 

4. 然後會生成.gitconfig文件,該文件在用戶的主目錄下,內容如下:

[core]
    editor = vim
[commit]
    template = /home/xxxx/git_template
[user]
    email = [email protected]
    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://[email protected]/maser_name/branch_name.git)這裏注意前邊的ssh,注意這一條與參考文獻中的說明不同。另外,有時需要加端口號:git clone ssh://[email protected]port number/maser_name/branch_name.git
  6. 向遠程倉庫push本地倉庫

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章