-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to automatically push to remote mirror repository #3480
Comments
Good idea, I have been looking for such a option already. IMHO this would increase adoption of Gitea. People would be more inclined to using Gitea if they knew that they could easily mirror stuff to GitLab/Github without having to fiddle with hooks. |
I'm also pretty interested in this, and wouldn't mind having a go at implementing it if someone could point me in the right direction! |
Right now I am doing this on a project of mine. Since I am the admin of the instance, I have access to the git hooks of the repos, and I can add this as the post-receive hook: #!/bin/bash
git push --mirror --quiet https://user:token@github.com/osuripple/hanayo.git &> /dev/null
echo 'osuripple/hanayo updated' Of course, this is just a hack, and a proper mechanism would be gladly appreciated. |
this would be a really nice feature to have in Gitea, please! |
Yeah this would be an amazingly useful feature! |
Is this really just a limitation of other systems disguised to look like a feature in Gitea? If Webhooks can do it why run the risk and adding complexity trying to make Gitea manage features absent from other products? Now, if we could have an SVN push mirror that would be extremely useful use case for the ad hoc nature of the umptysquillion poorly managed WordPress SVN repos in existence today who would gladly being porting over go Gitea to simplify their workflow and reduce premature aging. |
@thehowl Thanks. I made a slight modification so I don't have to wait for the push to the mirror to complete (which can be slow).
Of course now you no longer have a confirmation that the push succeeded but a main motivation for my use case of gitea was to avoid the long lags of updates to slow remote hosts. |
The git hook trick won't work for mirror repos. And a lot of services don't respond to inbound webhooks, for example gitea itself doesn't, a simple ssh server acting as a git remote, etc. Having this built in would be useful. |
You have to store the token or private key on gitea if we implement that. |
This is a very interesting feature! |
+1 |
This would be a very useful feature. It would be great to have a system where users could develop a project on our hosted Gitea instance and then 'publish' it to a public git service by setting it up as a mirrored repo. |
No, ssh auth forwarding could be used. |
After I used the hack from above, I've written an post receive script to update the remote repo with all changes from gitea. All changes made in gitea will be automatically pushed to the "mirror repo" but not the other way around. Updating the gitea repo is still manually. It is unfortunately still necessary to update the config file of the repo and the git authentication on the maschine running gitea:
|
Any progress on adding this to the gitea source? It seems like all we have are workarounds, Fairly clever ones at that, but some actual progress would be a good sign. Gitlab has this feature built in already Might be some useable code there. |
It's not ideal but drone ci could be used to push changes further to other git server |
@lafriks I have TeamCity already in place and working well for the business, so dont really want to change CI product, just keen to have a commit gating process like the one shown. |
@WattsC-90 I mean it could be done in TeamCity too, it's an interesting suggestion and I'm considering it -- we have an internal CI server that we build everything on, then sometimes our customers have their own repos/servers/etc that right now we manually push to, would be nice to stop doing that.. I could just make part of TeamCity's build process to push out to the external repo on successful build (a good-ish idea), and even if TeamCity was on the other "side" of the push, I could just make a build that does nothing but sync on change. Not the best workaround, but even with Gitlab we're worried that repo mirroring and security won't be the best, so it is kind of a "if nothing else works, make CI do it". |
@StrangeWill I found this in my downtime, might be an interesting reference to how it could be done... https://github.com/takezoe/gitmesh just wonder if by having a topology similar to that shown in the github repo linked, the logic could be put in the "controller" level (see link), to push to "golden" repo (or potentially any other task..) |
I wonder if it would also be possible to mirror the issue tracker with a bot. |
I took your adaptation a bit further: Be aware, that |
If we want gitea to do that, it depends on #12065 |
For anyone wanting to update a github mirror with a deploy key rather than access token:
|
This is a very nice feature! |
If you'd like to promote this, please add
To the Issue summary Edit: @techknowlogick can this get the |
I've started some days ago working on this. |
@KN4CK3R dont forget to claim the bounty :) |
I like the feature of mirroring the repositories by pulling the remote repositories.
Is it possible to make gitea to push local repositories to remote mirror repositories?
It's nice if gitea is able to automatically push local repositories to remote mirror repositories such as github, gitlab or other git services.
The text was updated successfully, but these errors were encountered: