Skip to content
Snippets Groups Projects
Select Git revision
  • 3eaa60d6c086d8573f37ffc22e28cec2fb44e4c6
  • master default protected
  • kuglerl93-master-patch-83288
  • fritzm97-master-patch-31221
  • 03-2025
5 results

Git

Name Last commit Last update
..
README.md
git-repos-sync

Git Tipps and Tools

There is a lot of ways how to use git and sometimes a working solution can be very helpful for everybody. So please share you experience and working solutions.

HowTo Sync a GitHub and a GitLab repository

It is easy to import a GitHub repo into GitLab and the otherway around. However, if you want to make sure you can have both repos at the same state, you need to syncronize them.

How to call: ./git-repos-sync [URL1] [URL2] [Branch] This means:

  • URL1 - Address of the first remote repository
  • URL2 - Address of the second remote repository
  • The order of URL1 or URL2 does not matter.
  • Branch is usually master

Different use cases:

  1. You have already a local copy of either of the repositories (e.g. GitLab or GitHub)
  2. You have no local copy of either repository.

Case 1

cd dir-of-repo
# copy the script there
wget https://gitlab.phaidra.org/imgw/computer-resources/-/raw/master/Git/git-repos-sync
# make executable
chmod +x git-repos-sync
# execute the script
./git-repos-sync [URL] [URL] [Branch]

Case 2

# Create a new folder to do the sync, can be any name
mkdir sync-repos
# copy the script there
wget https://gitlab.phaidra.org/imgw/computer-resources/-/raw/master/Git/git-repos-sync
# make executable
chmod +x git-repos-sync
# execute the script
./git-repos-sync [URL] [URL] [Branch]