Jump to content

Git/Mirrors: Difference between revisions

From Bath Wiki
Translate from boss.bathcs.com
 
Change from bathcs.com to gitlab.bath.ac.uk.
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
Some projects could be a student’s heart and soul. We do not want to take this away from them, instead we just want to store a copy of the current version on bathcs.com.
Some projects could be a student’s heart and soul. We do not want to take this away from them, instead we just want to store a copy of the current version on [https://gitlab.bath.ac.uk the university's Gitlab].


So the solution to this is to have a mirror repo.
So the solution to this is to have a mirror repo.
Line 24: Line 24:
<syntaxhighlight lang="sh">git checkout branch-name
<syntaxhighlight lang="sh">git checkout branch-name
git push bath HEAD:main</syntaxhighlight>
git push bath HEAD:main</syntaxhighlight>
== See also ==
{{Special:PrefixIndex|prefix=Git|namespace=0|hideredirects=1}}
[[Category:Tutorial]]

Latest revision as of 22:43, 11 June 2026

Some projects could be a student’s heart and soul. We do not want to take this away from them, instead we just want to store a copy of the current version on the university's Gitlab.

So the solution to this is to have a mirror repo.

There are multiple ways to solve this:

GitLab Mirror

In GitLab go to “Settings > Repository > Mirroring Repositories”, you can see there is an option to “push” to another repo.

This means that if the student has their own GitLab instance where they store their own version, they can setup this pushing feature to push to a repo on the GitLab.

However, due to security restrictions, this only works when the other server is connected to the University Intranet, so it is not feasible.

Just do it manually

When doing it manually, you can just push to two separate repositories when making changes locally, by going:

git add remote bath git@gitlab.bath.ac.uk:cs/wiki
git push
git push bath

If you were wanting to have a specialised branch which has some extra features, you can do something like:

git checkout branch-name
git push bath HEAD:main

See also