git-fork: prompt for password before 2FA code.

Fix #750.
This commit is contained in:
spacewander 2019-06-02 12:20:09 +08:00
parent 4b09e94853
commit c3c0bdfbbb

View file

@ -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"