Git Tips

Git 使用技巧

Git 使用小技巧

取消 sslVerify

应对 SNI 阻断

git config --global http.sslVerify false

使用 SSH 替代 HTTP 方式拉取 Repo

尤其适合 Golang 从私有仓库拉取包

~/.gitconfig

1
2
3
4
[url "git@github.com:"]
    insteadOf = https://github.com/
[url "git@gitlab.com:"]
    insteadOf = https://gitlab.com/
1
2
3
4
5
6
# 或者:

git config --global url."git@gitlab.com:groupName/projectName.git".insteadOf "https://gitlab.com/groupName/projectName.git"`

# 全局替换,拉取域名下的所有包
git config --global url."git@gitlab.yoursite.com:".insteadof "https://gitlab.yoursite.com/"

Git 跟踪文件更改

1
git log --follow --patch routes/admin/contract_operation.js

Licensed under CC BY-NC-SA 4.0
Built with Hugo
主题 StackJimmy 设计