This is a simple method to create backups of your repository, that can be easily updated while stored remotely.
In the directory you want to store the repository backup run:
$ git clone --mirror $url
If the repository contains LFS objects run:
$ cd backup-repo.git $ git lfs fetch --all
Periodically run a remote update to keep the backup relevant:
$ git remote update --prune
Running a remote update with
--prunewill remove any branches that have also been removed from the original repository.