Error 500 when updating githooks on mirrored repositories #1637

Closed
opened 2025-11-02 04:07:58 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @johanhugg on GitHub (Mar 20, 2018).

  • Gitea version (or commit ref): 1.5.0-dev
  • Git version:
  • Operating system: Windows 10 x64
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Since try.gitea.io isn't working at the time of this writing I couldn't test it. But after looking at the code the issue should exist there too.

When creating a migration, and the repository is a mirror, the code doesn't seem to create the git hook repositories that it expects to find, resulting in a file not found error. Image 1 shows a newly created repository that isn't a mirror. There we can see three folders that contain the three sample hooks that are presented in the Gitea Web GUI (Image 2). A newly created repository that is a mirror, doesn't create these folders (Image 3).

Is this intended? Is there a reason why you shouldn't be able to create git hooks for mirrored repositories?

Screenshots

Image 1

image

Image 2

image

Image 3

image

Originally created by @johanhugg on GitHub (Mar 20, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.5.0-dev - Git version: - Operating system: Windows 10 x64 - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Since try.gitea.io isn't working at the time of this writing I couldn't test it. But after looking at the code the issue should exist there too. When creating a migration, and the repository is a mirror, the code doesn't seem to create the git hook repositories that it expects to find, resulting in a file not found error. Image 1 shows a newly created repository that isn't a mirror. There we can see three folders that contain the three sample hooks that are presented in the Gitea Web GUI (Image 2). A newly created repository that is a mirror, doesn't create these folders (Image 3). Is this intended? Is there a reason why you shouldn't be able to create git hooks for mirrored repositories? ## Screenshots ## Image 1 ![image](https://user-images.githubusercontent.com/1291530/37654693-4ea78972-2c43-11e8-86fa-d8daccce4966.png) ## Image 2 ![image](https://user-images.githubusercontent.com/1291530/37654742-7c1655e6-2c43-11e8-9bdc-5a1fa77913a8.png) ## Image 3 ![image](https://user-images.githubusercontent.com/1291530/37654771-9215679c-2c43-11e8-8006-cd728d6065e9.png) <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 04:07:59 -06:00
Author
Owner

@rixx commented on GitHub (Jun 18, 2018):

Seconding this issue/question. I'd love to use a gitea mirror to execute git hooks on my git server host – having git hooks available would be very helpful.

@rixx commented on GitHub (Jun 18, 2018): Seconding this issue/question. I'd love to use a gitea mirror to execute git hooks on my git server host – having git hooks available would be very helpful.
Author
Owner

@lunny commented on GitHub (Jun 19, 2018):

@rixx any logs?

@lunny commented on GitHub (Jun 19, 2018): @rixx any logs?
Author
Owner

@rixx commented on GitHub (Jun 19, 2018):

There aren't really any logs – while the frontend shows a large "500", the logs show a 404, which happens when gitea tries to access the non-existing hook directory (usually there is a post-receive.d).

But that's not really the point – I have manually created a post-receive.d, and while I can edit the post receive hook after that, naturally, it doesn't get triggered when the mirror repository gets updated from the upstream repository.

(Motivation: It would be really cool if this was possible – this would allow to do stuff like continuous delivery from your own servers with very little effort for repositories you can't or won't move away from other platforms.)

If I can provide more help, please tell me – unfortunately the mirror update doesn't seem to log anything to the syslog on my machine, so I can't tell you if it has any issues. Mirror updates definitely happen correctly as before.

@rixx commented on GitHub (Jun 19, 2018): There aren't really any logs – while the frontend shows a large "500", the logs show a 404, which happens when gitea tries to access the non-existing hook directory (usually there is a `post-receive.d`). But that's not really the point – I have manually created a `post-receive.d`, and while I can edit the post receive hook after that, naturally, it doesn't get triggered when the mirror repository gets updated from the upstream repository. (*Motivation:* It would be really cool if this was possible – this would allow to do stuff like continuous delivery from your own servers with very little effort for repositories you can't or won't move away from other platforms.) If I can provide more help, please tell me – unfortunately the mirror update doesn't seem to log anything to the syslog on my machine, so I can't tell you if it has any issues. Mirror updates definitely happen correctly as before.
Author
Owner

@MirisWisdom commented on GitHub (Oct 16, 2018):

Can confirm that this issue appears on 1.5.2 -- both in a Docker and normal environment. Only one relevant line pops up in the log:

2018/10/16 06:07:52 [...ters/repo/setting.go:647 GitHooksEditPost()] [E] hook.Update: open /data/git/repositories/org/project.git/hooks/post-receive.d/post-receive: no such file or directory
@MirisWisdom commented on GitHub (Oct 16, 2018): Can confirm that this issue appears on 1.5.2 -- both in a Docker and normal environment. Only one relevant line pops up in the log: ``` 2018/10/16 06:07:52 [...ters/repo/setting.go:647 GitHooksEditPost()] [E] hook.Update: open /data/git/repositories/org/project.git/hooks/post-receive.d/post-receive: no such file or directory ```
Author
Owner

@stale[bot] commented on GitHub (Jan 6, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 6, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@rixx commented on GitHub (Jan 6, 2019):

Regardless, this issue still occurs.

@rixx commented on GitHub (Jan 6, 2019): Regardless, this issue still occurs.
Author
Owner

@Multipixelone commented on GitHub (Jan 17, 2019):

Can confirm I'm also getting this issue on Gitea version 1.5.3

@Multipixelone commented on GitHub (Jan 17, 2019): Can confirm I'm also getting this issue on Gitea version 1.5.3
Author
Owner

@stale[bot] commented on GitHub (Mar 18, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Mar 18, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@rixx commented on GitHub (Mar 18, 2019):

Regardless, this issue still occurs.

@rixx commented on GitHub (Mar 18, 2019): Regardless, this issue still occurs.
Author
Owner

@fbrinker commented on GitHub (Oct 19, 2019):

Yep found out about the same error today. I wanted to start build jobs of another repository, using a mirrored repository since the webhooks can't send custom post parameters

To bad this doesn't work either :(

@fbrinker commented on GitHub (Oct 19, 2019): Yep found out about the same error today. I wanted to start build jobs of another repository, using a mirrored repository since the webhooks can't send custom post parameters To bad this doesn't work either :(
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1637