Note : Make sure before running this script you have created your IAM user and configured on your server
# cd /opt
# vi script.sh
#!/bin/bash
# This script made for GIT migration on AWS CodeCommit
RED="\e[31m"
GREEN="\e[32m"
BLUE="\e[34m"
BOLD="\e[1m"
BOLDGREEN="\e[1;${GREEN}m"
ENDCOLOR="\e[0m"
echo -e "${GREEN}Enter Git project name${ENDCOLOR}"
read project
echo -e "${GREEN}Please Enter GIT repo URL${ENDCOLOR}"
read gitpath
echo -e "${GREEN}Please Enter CodeCommit repo URL${ENDCOLOR}"
read CodeCommit
#mirroe git code
git clone --mirror $gitpath $project
cd $project
git branch
git remote add sync $CodeCommit
git push sync --mirror
if [ $? = "0" ]
then
echo -e "${GREEN} git url $gitpath migrated successfully${ENDCOLOR}"
else
echo -e "${GREEN} git url $gitpath migration failed please check${ENDCOLOR}"
fi
sleep 5
git branch -r
echo -e "${GREEN} Press Enter to complete migration${ENDCOLOR}"
read p
No comments:
Post a Comment