Skip to content

Instantly share code, notes, and snippets.

@abidkhan484
Created January 11, 2024 03:59
Show Gist options
  • Save abidkhan484/390fd5b4f604ec3293e072d756f0d0e3 to your computer and use it in GitHub Desktop.
Save abidkhan484/390fd5b4f604ec3293e072d756f0d0e3 to your computer and use it in GitHub Desktop.
Manage two different Git servers

Manage two different Git servers

There is a need to manage multiple Git servers for the development and deployment.

Repository Clone

To clone the source repository

  git clone $SOURCE_REPOSITORY_URL

Add destination remote origin

  git remote add downstream $UPSTREAM_REPOSITORY_URL

Push to the destination repository

  git push downstream $BRANCH_NAME

Usage/Examples

  git checkout -b $BRANCH_NAME
  git pull origin $BRANCH_NAME
  git push downstream $BRANCH_NAME

Sample origin details

└─(09:46:25 on test-branch)──> git remote -v

downstream	https://gitlab.somewhere.com/user/repo (push)
downstream	https://gitlab.somewhere.com/user/repo (fetch)
origin	https://gitlab.elsewhere.com/otheruser/otherrepo.git (fetch)
origin	https://gitlab.elsewhere.com/otheruser/otherrepo.git (push)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment