Hacker News new | past | comments | ask | show | jobs | submit login

I have created a small tool that automatically mirrors public repos from GitLab to GitHub: https://github.com/grdl/gitlab-mirror-maker

Meaning, a repo can be hosted on GL but still benefit from better exposure and disoverability of GH.




How I usually do it if I want to have my project on Github and Gitlab is configure two push remotes like this:

> git remote set-url --add --push origin <github-remote>

> git remote set-url --add --push origin <gitlab-remote>

This way I have an automatic backup to the second remote.


Does this mean when you `git push origin <branch>` it gets pushed to both remotes? I had no idea you could have two remotes with the same name, neat!


TIL that's exactly what this does, alternatively you can add them all to an 'all' remote, to make it more explicit:

https://jigarius.com/blog/multiple-git-remote-repositories#t...

However, you can add multiple URLs to 'origin' and push to them all at once.


But GitLab already has repo mirroring built-in, what am I missing?


You're not missing anything. It does use GitLab's mirroring API. However, GitLab doesn't have any global mirroring settings, you need to set up each repo individually. The tool just saves you a huge bunch of clicking around and copy pasting auth tokens. Useful if you have a big collection of repos you'd like to mirror. And if you'd like every new public repo to be mirrored automatically.


it's a paid feature: not in community gitlab


Pushing from gitlab to another git host is free and in the community edition[1]. Pulling on the other hand is a paid feature.

[1]: https://docs.gitlab.com/13.2/ee/user/project/repository/repo...


If your project is open source on gitlab.com - you get all paid features for free.


Here is a link to our program for open source projects for anyone interested! https://about.gitlab.com/solutions/open-source/ (community advocate at GitLab)


This is awesome! Thanks for sharing.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: