mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-16 05:02:29 -05:00
Ability to automatically push to remote mirror repository #1512
Closed
opened 2025-11-02 04:03:25 -06:00 by GiteaMirror
·
28 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16.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-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#1512
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yanjiew1 on GitHub (Feb 9, 2018).
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.
@mxmehl commented on GitHub (Feb 12, 2018):
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.
@ghost commented on GitHub (Feb 22, 2018):
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!
@thehowl commented on GitHub (Mar 3, 2018):
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:
Of course, this is just a hack, and a proper mechanism would be gladly appreciated.
@ulm0 commented on GitHub (Aug 6, 2018):
this would be a really nice feature to have in Gitea, please!
@ghost commented on GitHub (Aug 12, 2018):
Yeah this would be an amazingly useful feature!
@ghost commented on GitHub (Aug 13, 2018):
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.
@snth commented on GitHub (Nov 9, 2018):
@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.
@pklapperich commented on GitHub (Mar 15, 2019):
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.
@lunny commented on GitHub (Mar 16, 2019):
You have to store the token or private key on gitea if we implement that.
@chotaire commented on GitHub (Apr 7, 2019):
This is a very interesting feature!
@belliash commented on GitHub (May 3, 2019):
+1
@HarvsG commented on GitHub (Jul 18, 2019):
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.
@millergarym commented on GitHub (Sep 22, 2019):
No, ssh auth forwarding could be used.
@petrac-daniel commented on GitHub (Oct 1, 2019):
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:
@PeterHindes commented on GitHub (Nov 21, 2019):
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.
@WattsC-90 commented on GitHub (Mar 26, 2020):
I am interested in this feature primarily because our current infrastructure uses mirrored servers globally for developers to use to improve speeds, there is a node next to (virtually) the build agent/cluster to speed up build checkouts etc. too. This includes failover too, if the primary node goes down, then we can turn one of the mirrors into primary. (I must note, we are using SVN, so the use of master/slave nodes may be redundant, but I want to pitch in with why I was looking and my use case to help, if possible, improve the end result.) I am loving the feel of this project and shall be looking to pull our SVN system over to GIT if corporate decision makers allow... just needs the right feature set!
Another use case we have discussed previously is to commit to one server for code reviews, and then once the code review is done, push it to the master. Whenever you checkout, you get it from the master. Similar to the diagram here (only the last two stages with
"push to gerrit"and"submit". Mirroring functionality would allow such a feature to be offered.[referenced from: https://www.bsi-software.com/fileadmin/daten/processed/5/7/csm_Gerrit_workflow_33e6332529.png]
@lafriks commented on GitHub (Mar 28, 2020):
It's not ideal but drone ci could be used to push changes further to other git server
@WattsC-90 commented on GitHub (Mar 29, 2020):
@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.
@StrangeWill commented on GitHub (Mar 29, 2020):
@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".
@WattsC-90 commented on GitHub (Apr 3, 2020):
@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..)
@poperigby commented on GitHub (May 1, 2020):
I wonder if it would also be possible to mirror the issue tracker with a bot.
@keks24 commented on GitHub (Aug 5, 2020):
I took your adaptation a bit further:
https://github.com/keks24/git-hooks/blob/master/home/gitea/.local/share/gitea/hooks/post-receive.d/post-receive
Be aware, that
git push --forcewill fail on the mirrors, if branches are protected.@lunny commented on GitHub (Aug 5, 2020):
If we want gitea to do that, it depends on #12065
@neumantm commented on GitHub (Sep 5, 2020):
For anyone wanting to update a github mirror with a deploy key rather than access token:
@rexzhang commented on GitHub (Sep 23, 2020):
This is a very nice feature!
@kdumontnu commented on GitHub (Feb 9, 2021):
Bounty added:
If you'd like to promote this, please add
To the Issue summary
Edit: @techknowlogick can this get the
bountybadge?@KN4CK3R commented on GitHub (Mar 25, 2021):
I've started some days ago working on this.
@6543 commented on GitHub (Jun 14, 2021):
@KN4CK3R dont forget to claim the bounty :)