From dca21402e409427c6f9e38fc95e73369b615ce6d Mon Sep 17 00:00:00 2001 From: Leo Baker-Hytch Date: Sat, 12 Apr 2014 23:36:32 +0100 Subject: [PATCH 1/2] Recommended alternate config file for GitHub token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since it’s pretty common to keep .gitconfig in a public repo, I changed the recommendation to use an alternate config file, that git config also reads from (see FILES in the man page). --- github-create | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-create b/github-create index e2ed3d3..29b7647 100644 --- a/github-create +++ b/github-create @@ -21,7 +21,7 @@ github-create() { token=`git config github.token` if [ "$token" = "" ]; then - echo " Could not find token, run 'git config --global github.token '" + echo " Could not find token, run 'mkdir -p ~/.config/git; git config --file ~/.config/git/config github.token '" invalid_credentials=1 fi From cf4df886ceeeb9ebb32a6f755c63c3dcf818961b Mon Sep 17 00:00:00 2001 From: Leo Baker-Hytch Date: Wed, 23 Apr 2014 00:44:14 +0100 Subject: [PATCH 2/2] Made variables local (to stop them leaking outside the function) --- github-create | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/github-create b/github-create index 29b7647..5f99a2d 100644 --- a/github-create +++ b/github-create @@ -1,8 +1,8 @@ github-create() { - repo_name=$1 + local repo_name=$1 - dir_name=`basename $(pwd)` - invalid_credentials=0 + local dir_name=`basename $(pwd)` + local invalid_credentials=0 if [ "$repo_name" = "" ]; then echo " Repo name (hit enter to use '$dir_name')?" @@ -13,13 +13,13 @@ github-create() { repo_name=$dir_name fi - username=`git config github.user` + local username=`git config github.user` if [ "$username" = "" ]; then echo " Could not find username, run 'git config --global github.user '" invalid_credentials=1 fi - token=`git config github.token` + local token=`git config github.token` if [ "$token" = "" ]; then echo " Could not find token, run 'mkdir -p ~/.config/git; git config --file ~/.config/git/config github.token '" invalid_credentials=1