⚡ git-identity
This commit is contained in:
parent
28f1604b78
commit
386ff7259c
@ -40,20 +40,6 @@
|
|||||||
autoSquash = true
|
autoSquash = true
|
||||||
autoStash = true
|
autoStash = true
|
||||||
updateRefs = true
|
updateRefs = true
|
||||||
# me
|
|
||||||
[user]
|
|
||||||
name = Jan Andrle
|
|
||||||
email = andrle.jan@centrum.cz
|
|
||||||
signingkey = B3A25AED155AFFAB
|
|
||||||
[credential]
|
|
||||||
# see https://stackoverflow.com/questions/5343068/is-there-a-way-to-cache-https-credentials-for-pushing-commits/18362082#18362082
|
|
||||||
helper = /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
|
|
||||||
[credential "https://github.com"]
|
|
||||||
helper = !/usr/bin/gh auth git-credential
|
|
||||||
[credential "https://gist.github.com"]
|
|
||||||
helper = !/usr/bin/gh auth git-credential
|
|
||||||
[credential "https://git.dhl.com"]
|
|
||||||
helper = !/usr/bin/gh auth git-credential
|
|
||||||
# my setup
|
# my setup
|
||||||
[core]
|
[core]
|
||||||
editor = vim
|
editor = vim
|
||||||
@ -126,11 +112,5 @@
|
|||||||
[am]
|
[am]
|
||||||
# keepcr = true # to preserve line endings
|
# keepcr = true # to preserve line endings
|
||||||
threeWay = true
|
threeWay = true
|
||||||
[sendemail]
|
[include]
|
||||||
anotate = true
|
path = ./identities/current.conf
|
||||||
smtpserver = smtp.centrum.cz
|
|
||||||
# chainReplyTo = false
|
|
||||||
suppresscc = self
|
|
||||||
smtpuser = andrle.jan@centrum.cz
|
|
||||||
smtpencryption = ssl
|
|
||||||
smtpserverport = 465
|
|
||||||
|
21
.config/git/identities/default.conf
Normal file
21
.config/git/identities/default.conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[user]
|
||||||
|
name = Jan Andrle
|
||||||
|
email = andrle.jan@centrum.cz
|
||||||
|
signingkey = B3A25AED155AFFAB
|
||||||
|
[credential]
|
||||||
|
# see https://stackoverflow.com/questions/5343068/is-there-a-way-to-cache-https-credentials-for-pushing-commits/18362082#18362082
|
||||||
|
helper = /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
|
||||||
|
[credential "https://github.com"]
|
||||||
|
helper = !/usr/bin/gh auth git-credential
|
||||||
|
[credential "https://gist.github.com"]
|
||||||
|
helper = !/usr/bin/gh auth git-credential
|
||||||
|
[credential "https://git.dhl.com"]
|
||||||
|
helper = !/usr/bin/gh auth git-credential
|
||||||
|
[sendemail]
|
||||||
|
anotate = true
|
||||||
|
smtpserver = smtp.centrum.cz
|
||||||
|
# chainReplyTo = false
|
||||||
|
suppresscc = self
|
||||||
|
smtpuser = andrle.jan@centrum.cz
|
||||||
|
smtpencryption = ssl
|
||||||
|
smtpserverport = 465
|
39
bin/git-identity
Executable file
39
bin/git-identity
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
config="$HOME/.config/git/identities"
|
||||||
|
input="${1:-}"
|
||||||
|
usage="Usage
|
||||||
|
git identity [<name>|help|-]
|
||||||
|
git-identity --help
|
||||||
|
"
|
||||||
|
[ -z "$input" ] \
|
||||||
|
&& echo "$usage"\
|
||||||
|
&& echo -e "$config/current.conf … current identity:" \
|
||||||
|
&& cat "$config/current.conf" \
|
||||||
|
&& exit 0
|
||||||
|
[ "$input" = --help ] \
|
||||||
|
&& input="help"
|
||||||
|
[ "$input" = help ] \
|
||||||
|
&& echo "$usage"\
|
||||||
|
&& echo '- _empty_: shows usage and current identity' \
|
||||||
|
&& echo '- <name>: set identity' \
|
||||||
|
&& echo '- -: show path to identities directory' \
|
||||||
|
&& echo '- help: shows this help' \
|
||||||
|
&& echo -e '\n\nExamples' \
|
||||||
|
&& echo '- git identity' \
|
||||||
|
&& echo '- git identity user' \
|
||||||
|
&& echo '- ls $(git identity -)' \
|
||||||
|
&& echo -e '\n\nGit config' \
|
||||||
|
&& echo "- git config --global include.path '$config/current.conf'" \
|
||||||
|
&& exit 0
|
||||||
|
[ "$input" = - ] \
|
||||||
|
&& echo "$config" \
|
||||||
|
&& exit 0
|
||||||
|
|
||||||
|
identity="$config/$input.conf"
|
||||||
|
[ ! -e "$identity" ] \
|
||||||
|
&& echo "No such identity: $input" >&2 \
|
||||||
|
&& echo "$identity" >&2 \
|
||||||
|
&& exit 1
|
||||||
|
|
||||||
|
ln --verbose --force "$identity" "$config/current.conf"
|
Loading…
x
Reference in New Issue
Block a user