Created
July 25, 2019 08:13
-
-
Save katzefudder/0007dd44fea432ac75d55d88b74b8fdd to your computer and use it in GitHub Desktop.
Changing upstream from Gitlab to Bitbucket (migration)
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 | |
function changeUpstream() { | |
cd /tmp && git clone --quiet $1 | |
basename=$(basename $1) | |
dirname=${basename%.*} | |
cd $dirname | |
clear | |
echo "###### You are about to execute the following commands on $basename ######" | |
command1="git remote set-url origin $2" | |
command2="git push -u origin master" | |
echo $command1 | |
echo $command2 | |
echo '###### ------------------------------------------------ ######' | |
read -r -p "Are you sure (y,n) ?" response | |
case "$response" in | |
[yY][eE][sS]|[yY]) | |
echo $command1 | |
echo $command2 | |
#eval $command1 > /dev/null 2>&1 | |
#eval $command2 > /dev/null 2>&1 | |
;; | |
*) | |
echo 'exiting...' | |
;; | |
esac | |
rm -Rf /tmp/$dirname | |
} | |
echo '###### Migration from GitLab to Bitbucket' | |
read -p "Enter your GitLab Repository: " gitLabRepo | |
read -p "Enter your Bitbucket Repository: " bitbucketRepo | |
changeUpstream $gitLabRepo $bitbucketRepo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment