Skip to content

Commit e1cb3aa

Browse files
committed
Move git user creation out of macOS bootstrapping
1 parent 3ab73fd commit e1cb3aa

2 files changed

Lines changed: 21 additions & 17 deletions

File tree

home/bin/bootstrap-macos.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -382,20 +382,4 @@ if ! test "$HOME/.oh-my-zsh/"; then
382382
sh /tmp/install-oh-my-zsh.sh
383383
fi
384384

385-
386-
if ! git config --get user.email; then
387-
# Git commit config
388-
printf 'Name for git commits (ie. John Foo): '
389-
read GIT_NAME
390-
printf 'Email for git commits (john.foo@example.com): '
391-
read GIT_EMAIL
392-
393-
# Configure git
394-
printf "Set git config to use %s <%s>? [y/n]: " "$GIT_NAME" "$GIT_EMAIL"
395-
read reply
396-
if [[ $reply =~ ^[Yy]$ ]]
397-
then
398-
git config --global user.name "$GIT_NAME"
399-
git config --global user.email "$GIT_EMAIL"
400-
fi
401-
fi
385+
~/bin/setup-git-user.sh

home/bin/setup-git-user.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
if ! git config --get user.email; then
6+
# Git commit config
7+
printf 'Name for git commits (ie. John Foo): '
8+
read GIT_NAME
9+
printf 'Email for git commits (john.foo@example.com): '
10+
read GIT_EMAIL
11+
12+
# Configure git
13+
printf "Set git config to use %s <%s>? [y/n]: " "$GIT_NAME" "$GIT_EMAIL"
14+
read reply
15+
if [[ $reply =~ ^[Yy]$ ]]
16+
then
17+
git config --global user.name "$GIT_NAME"
18+
git config --global user.email "$GIT_EMAIL"
19+
fi
20+
fi

0 commit comments

Comments
 (0)