Last active
August 29, 2015 14:05
-
-
Save ronisaha/ea130f5643cc5af3c760 to your computer and use it in GitHub Desktop.
Update git repository if your system does not ask for git password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -n "Enter github Username: " | |
read USER_NAME | |
echo -n "Enter github repository name: " | |
read REPO_NAME | |
echo -n "Enter Password:" | |
read -s PASSWORD | |
echo | |
git checkout . | |
TEMP_REMOTE_NAME="temp$(date +%Y%m%d%H%m%s)" | |
{ | |
git remote add ${TEMP_REMOTE_NAME} "https://$USER_NAME:$PASSWORD@github.com/$REPO_NAME.git" | |
} || { | |
echo | |
} | |
{ | |
git pull ${TEMP_REMOTE_NAME} master | |
} || { | |
echo "Unable to update code from git" | |
} | |
git remote remove ${TEMP_REMOTE_NAME} | |
echo "Operation completed..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment