From c3c0bdfbbbc9ef5f2f9fb441150eeb75538c0978 Mon Sep 17 00:00:00 2001 From: spacewander Date: Sun, 2 Jun 2019 12:20:09 +0800 Subject: [PATCH] git-fork: prompt for password before 2FA code. Fix #750. --- bin/git-fork | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/git-fork b/bin/git-fork index aa6c95a..7c651be 100755 --- a/bin/git-fork +++ b/bin/git-fork @@ -14,6 +14,8 @@ test -z "$url" && abort "github repo needs to be specified as an argument" echo "Enter your github username" read user [ -n "$user" ] || abort "git username required" +echo "Enter github password for user \"$user\"" +read -s passwd echo "Enter github two-factor authentication code (leave blank if not set up)" read MFA_CODE @@ -33,7 +35,7 @@ fi # create fork curl -qsf \ -X POST \ - -u "$user" \ + -u "$user:$passwd" \ -H "X-GitHub-OTP: $MFA_CODE" \ "https://api.github.com/repos/$owner/$project/forks"