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
7
8
# 或者:

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 config --global url."https://".insteadOf git://

Git 跟踪文件更改

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

使用 HTTP/1.1

1
git --global config http.version HTTP/1.1

Licensed under CC BY-NC-SA 4.0
最后更新于 Nov 15, 2023 19:23 +0800
Built with Hugo
主题 StackJimmy 设计