-
Notifications
You must be signed in to change notification settings - Fork 3
/
dot_gitconfig.tmpl
65 lines (55 loc) · 2.03 KB
/
dot_gitconfig.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# This file is managed by chezmoi in {{ .chezmoi.sourceFile }}. DO NOT EDIT directly.
# To modify, use `chezmoi edit ~/.gitconfig --apply`.
[user]
name = {{ .git.user.name | quote }}
email = {{ .git.user.email | quote }}
[init]
defaultBranch = main
[credential]
helper = cache --timeout={{ .git.credential.helper.cache.timeout }}
{{- if (index . "git") }}
{{- if (index . "git" "credential") }}
{{- if (index . "git" "credential" "helpers") }}
{{- if (index . "git" "credential" "helpers" "static") }}
{{- range .git.credential.helpers.static }}
# Force {{.site}} to use given username and password
[credential "{{.site}}"]
# see https://git-scm.com/docs/gitcredentials#_custom_helpers for elaboration
helper = "!f() { echo \"username={{.username}}\\npassword={{.password}}\"; }; f"
{{- end }}
{{- end }}
{{- end}}
{{- end}}
{{- end}}
{{- if (index . "git") }}
{{- if (index . "git" "credential") }}
{{- if (index . "git" "credential" "helpers") }}
{{- if (index . "git" "credential" "helpers" "env") }}
{{- range .git.credential.helpers.env }}
# Setup {{.site}} so that when Git needs username/password, they are retrieved from environment variables ${{.env_var_name_prefix}}USERNAME and ${{.env_var_name_prefix}}PASSWORD
[credential "{{.site}}"]
# see https://git-scm.com/docs/gitcredentials#_custom_helpers for elaboration
helper = "!f() { echo \"username=${{.env_var_name_prefix}}USERNAME\\npassword=${{.env_var_name_prefix}}PASSWORD\"; }; f"
{{- end }}
{{- end }}
{{- end}}
{{- end}}
{{- end}}
{{- if (index . "github") }}
{{- if (index . "github" "user") }}
{{- if (index . "github" "user" "prime") }}
{{- with .github.user.prime }}
{{- if and (index . "id") (index . "pat") (index . "insteadof_in_gitconfig") }}
[url "https://{{ .id }}:{{ .pat }}@github.com"]
insteadOf = https://github.com
{{- else}}
# 'id' 'pat' and 'insteadof_in_gitconfig' required in '.github.user.prime' if this is desired:
# [url "https://id:[email protected]"]
# insteadOf = https://github.com
{{- end}}
{{- end}}
{{- end}}
{{- end}}
{{- end}}
[pull]
rebase = false