git常用配置(指令)
1、配置用戶名和郵箱
(1) 指令設置
$ git config --global user.name "username"
$ git config --global user.email johndoe@example.com
(2)?修改配置文件.gitconfig
?
2、配置ssh key免密登錄
(1)?生成密鑰
$?ssh-keygen -t rsa -C '1046407517@qq.com'
(2)?在github添加自己生成的公鑰
點擊頭像=>Settings=>SSH and GPG keys=>New SSH Key=>保存即可
? ? ? ?(3)?測試添加的key是否成功
$ ssh -T git@github.com
? $ git remote -v 查看遠程git-url
4、配置默認編輯器notepad++
$ git config --global core.editor notepad++
$ git config --global core.editor "'D:\install\Notepad++\notepad++.exe' -multiInst -notabbar -nosession -noPlugin '$*'"
最終.gitconfig多以下配置
?
5 、配置difftool可視化工具
(1)difftool 配置
$ git config --global diff.tool bc4
$ git config --global difftool.bc4.cmd "\"d:/install/Beyond Compare 4/BComp.exe\" \"$LOCAL\" \"$REMOTE\""
最終.gitconfig將多出以下配置
? ? $ git difftool HEAD?// 比較當前修改情況
6、配置mergetool可視化工具
? ? ?(1)mergeftool 配置
? $?git config --global merge.tool bc4
? $?git config --global mergetool.bc4.cmd "\"d:/install/Beyond Compare 4/BComp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""
? $?git config --global mergetool.bc4.trustExitCode true
? ? ?(2)讓git mergetool不再生成備份文件(*.orig)
? $?git config --global mergetool.keepBackup false
最終.gitconfig將多出以下配置
?
$ git mergetool?//?對比當前沖突文件
?
轉載于:https://www.cnblogs.com/daishengda/p/9824711.html
總結
以上是生活随笔為你收集整理的git常用配置(指令)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 检测端口是否能连通
- 下一篇: centos7 python3.6编译安