Skip to content

Instantly share code, notes, and snippets.

@anilshrish
Created November 4, 2020 11:23
Show Gist options
  • Select an option

  • Save anilshrish/f7d4373551363e7eb53eba412a971a73 to your computer and use it in GitHub Desktop.

Select an option

Save anilshrish/f7d4373551363e7eb53eba412a971a73 to your computer and use it in GitHub Desktop.

Revisions

  1. anilshrish created this gist Nov 4, 2020.
    45 changes: 45 additions & 0 deletions git_migrate_repo.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    #### Clone git repo
    ```
    git clone --mirror https://github.com/miztiik/lex-faq-bot.git __tmp
    cd __tmp
    ```

    #### Git push to repo1
    ```
    git push https://github.com/anilshrish/lex-faq-bot1.git --all
    git push https://github.com/anilshrish/lex-faq-bot1.git --tags
    ```

    #### Git push to repo2
    ```
    git push https://github.com/anilshrish/lex-faq-bot2.git --all
    git push https://github.com/anilshrish/lex-faq-bot2.git --tags
    ```

    ### Migrate git repository to aws codeCommit:
    ```
    migration_dir="./_trash"
    git_url="https://github.com/miztiik/lex-faq-bot.git"
    aws_region="us-west-2"
    codecommit_repo_name="lex-faq-bot"
    # Initiate Migration
    # Create CodeCommit Repo
    aws codecommit create-repository \
    --repository-name ${codecommit_repo_name} \
    --repository-description "${codecommit_repo_name}" --profile default
    # Clone Git to local (only for migration purposes; not for local development)
    git clone --mirror ${git_url} ${migration_dir}
    # Push the repo to CodeCommit
    cd ${migration_dir}
    git push https://git-codecommit.${aws_region}.amazonaws.com/v1/repos/${codecommit_repo_name} --all
    git push https://git-codecommit.${aws_region}.amazonaws.com/v1/repos/${codecommit_repo_name} --tags
    # CleanUp - Remove local copy
    rm -rf ${migration_dir}
    ```