Tuesday, August 3, 2021

Script to migrate GIT Repo to AWS CodeCommit | GIT Repo Migration Bash Script


Bash script to migrate GIT repo to AWS CodeCommit : You can just copy this script and run to migrate your repo.

 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

Installing Jenkins on RHEL 8 is a straightforward process. Here's a step-by-step guide

Introduction  Jenkins is an open-source automation server widely used for continuous integration (CI) and continuous delivery (CD) pipelines...