Skip to content

Instantly share code, notes, and snippets.

@fmt
Forked from DavideMontersino/private-fork.md
Created August 17, 2018 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmt/4474c55965cd90c9e258c37d7f24ea5f to your computer and use it in GitHub Desktop.
Save fmt/4474c55965cd90c9e258c37d7f24ea5f to your computer and use it in GitHub Desktop.
How to fork to a private gitlab instance

Theory:

your git repository can have more than one remote server; In this case we want to have two:

  1. one for our private repository on gitlab (will be the default one, called origin)
  2. one to be connected to the source repo on github, to be able to pull new changes (will be called upstream)

How to make a private fork from github to gitlab

  # 1. clone the github project in your workspace
  git clone git@github.com:whatever/repo.git

  # 2. rename the remote
  git remote rename origin upstream

  # 3. Create a new repo in gitlab website

  # 4. Add the new origin to your repo

  git remote add origin git@gitlab.extranet.weborama.com:whatever/swiper.git

  # 5. push to the private repository (track master)

  git push -u origin master

To push to gitlab / master, just use

   git push

To retrieve updates from github, use

   git pull upstream master
@fmt
Copy link
Author

fmt commented Aug 17, 2018

git tag (list)
git tag vX.X
git push -u origin --tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment