diff --git a/bin/git-fork b/bin/git-fork index 05a4841f..04eb3a80 100755 --- a/bin/git-fork +++ b/bin/git-fork @@ -17,10 +17,10 @@ read -r user # personal access token # config name is github-personal-access-token '_' is not allowed in git config -if test -z "${GITHUB_TOKEN}"; then - github_personal_access_token=$(git config git-extras.github-personal-access-token) +if test -n "${GITHUB_TOKEN}"; then + github_personal_access_token="$GITHUB_TOKEN" else - github_personal_access_token=$GITHUB_TOKEN + github_personal_access_token=$(git config git-extras.github-personal-access-token) fi test -z "$github_personal_access_token" && abort "GITHUB_TOKEN, or git config git-extras.github-personal-access-token required" diff --git a/bin/git-pull-request b/bin/git-pull-request index 2730d2ee..3b51608b 100755 --- a/bin/git-pull-request +++ b/bin/git-pull-request @@ -31,10 +31,10 @@ EOF # personal access token # config name is github-personal-access-token '_' is not allowed in git config -if test -z "${GITHUB_TOKEN}"; then - github_personal_access_token=$(git config git-extras.github-personal-access-token) +if test -n "${GITHUB_TOKEN}"; then + github_personal_access_token="$GITHUB_TOKEN" else - github_personal_access_token=$GITHUB_TOKEN + github_personal_access_token=$(git config git-extras.github-personal-access-token) fi test -z "$github_personal_access_token" && abort "GITHUB_TOKEN or git config git-extras.github-personal-access-token required" diff --git a/man/git-fork.1 b/man/git-fork.1 index e259745e..805fbf9b 100644 --- a/man/git-fork.1 +++ b/man/git-fork.1 @@ -49,7 +49,7 @@ A personal access token is required for making the API call to create a new fork Make sure the personal access token has the right \fBOAuth\fR scopes for the repo(s) . .P -Use \fBgit config \-\-global \-\-add git\-extras\.github\-personal\-access\-token \fR +Use \fBGITHUB_TOKEN\fR environment variable, or \fBgit config \-\-global \-\-add git\-extras\.github\-personal\-access\-token \fR . .P If using multiple accounts, override the global value in the specific repo using \fBgit config git\-extras\.github\-personal\-access\-token \fR