Skip to content

Instantly share code, notes, and snippets.

@mangangreg
Created April 23, 2021 17:48
Show Gist options
  • Save mangangreg/6006d2598f04d50a71b0b03b7f02592a to your computer and use it in GitHub Desktop.
Save mangangreg/6006d2598f04d50a71b0b03b7f02592a to your computer and use it in GitHub Desktop.
Git push from specific user
# Usage `gpushu <username>` from inside of a repo, to push to git from user, will get prompted for password
function gpushu(){
USERNAME=$1
REPO=`git config --get remote.origin.url | awk -F 'com' '{print $2}' | cut -c 2-`
git push "https://$USERNAME@github.com/$REPO"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment