Mirror one repo to another when they exist on the same instance, does it make sence?

Hi GitLab community!
I have spent few hours already trying to fix a mirror issue, but at this point I am not sure this even make sense to fix. Is it possible to mirror one repository/project in GitLab to another project in GitLab when both projects are in the same place/server/host not remote. Of what I read so far, when mirroring is explain, remote host is specified so when I think about it, it makes less sense to continue working on this issue.
But I am not sure if I am right or wrong at this point.
This probably won’t get an answer but just in case, I want to post here and ask for opinion on this issue. Thank you.

Hi @gnova,

Never tried it, but providing you put the full https url with fqdn then I don’t see why it wouldn’t work. The main question is why would you want to do this on the same instance? This doesn’t really make sense. It doesn’t really offer backup capability, since as soon as you delete something from one, it will delete from the other.

If you were mirroring to a secondary instance of Gitlab, then this would make sense, since if the first one died for some reason, then on the second server you still have everything. Although you would have everything also locally in the computer where you do git pull/push from as well.

If you explain what you are attempting to achieve, we can then possibly help further!

1 Like

@iwalker
Thank you for responding. :star2:
I am not sure what this user is trying to achieve tbh, after I read your response, I really think mirror is not the correct approach when working in the same instance. I though it is some kind of developers practice that I didn’t know about.
I was able to successfully mirror couple of my projects in GitLab.com (created empty project and set up mirror from another that already existed) which confused me little. It is doable in GitLab.com but why do it?

To be honest mirroring on the same server doesn’t really make sense. Since if something bad happens on the server, then you lose everything, including the mirrored repository.

I’ll give you an example where it can be useful.

So, I have my own Gitlab instance, and I have my code committed here. I set up mirroring to mirror my repositories for example to gitlab.com/myusername/myproject. Then, let’s say, my server fails, breaks, or something which means I no longer have it. But not to worry, since I have my repositories replicated somewhere else - in this instance - gitlab.com. So they are immediately available for me to use, and start making commits to, etc.

So, that could be considered some kind of redundancy/backup, in addition to example the administrator of my own instance making backups of the server - or snapshots. Another way of ensuring data integrity.

1 Like

mirroring on the same server doesn’t really make sense

This depends on what you’re trying to achieve. I maintain a utilities project that’s in a group with limited access, and then I wanted to share these utilities more widely. I spent unnecessarily long time fumbling with project mirroring from the closed group to a public repo on the same instance, and I still haven’t got it working.

The point is, I think there are use cases for project mirroring to the same instance. And I’m surprised it doesn’t just work. I’m using the latest gitlab-ee, self-hosted.