Jump to content

Git/Mirrors: Difference between revisions

From Bath Wiki
Translate from boss.bathcs.com
 
m Add a see also section
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}}
[[Category:Tutorial]]

Revision as of 20:36, 3 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 bathcs.com.

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