Push error #943

Closed
opened 2025-11-02 03:42:35 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @SemikolonDEV on GitHub (Aug 6, 2017).

  • Gitea version (or commit ref): 1.1.2
  • Git version: 2.7.4
  • Operating system: amd64
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

I would pushed to my Repo at the Gitea Server and became this error:

Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 374 bytes | 0 bytes/s, done. Total 4 (delta 2), reused 0 (delta 0) remote: ./hooks/pre-receive.d/gitea: line 2: /opt/gitea/gitea-1.1.2-linux-arm-7: No such file or directory To https://git.tysox.de/Semikolon/PasswordTyper.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.tysox.de/Semikolon/PasswordTyper.git'

Originally created by @SemikolonDEV on GitHub (Aug 6, 2017). - Gitea version (or commit ref): 1.1.2 - Git version: 2.7.4 - Operating system: amd64 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant ## Description I would pushed to my Repo at the Gitea Server and became this error: `Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 374 bytes | 0 bytes/s, done. Total 4 (delta 2), reused 0 (delta 0) remote: ./hooks/pre-receive.d/gitea: line 2: /opt/gitea/gitea-1.1.2-linux-arm-7: No such file or directory To https://git.tysox.de/Semikolon/PasswordTyper.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.tysox.de/Semikolon/PasswordTyper.git'`
GiteaMirror added the type/question label 2025-11-02 03:42:35 -06:00
Author
Owner

@lafriks commented on GitHub (Aug 6, 2017):

If you have changed gitea binary name or location you need to call rewrite hooks from admin dashboard page

@lafriks commented on GitHub (Aug 6, 2017): If you have changed gitea binary name or location you need to call rewrite hooks from admin dashboard page
Author
Owner

@andy0130tw commented on GitHub (Aug 7, 2017):

Having exactly the same issue above, when installing the latest docker image backed with SQLite as database, the push never succeeds.

Steps to reproduce:

  1. Create a repository via the web interface
  2. Clone it through HTTPS
  3. Make a commit
  4. Push and fail with error message "error: failed to push some refs to ..."

The log file /data/log/hooks/pre-receive is as follows:

2017/08/07 19:49:18 [T] GetProtectedBranchBy: http://localhost:10080/api/internal/branch/1/master
2017/08/07 19:49:18 [...io/gitea/cmd/hook.go:126 runHookPreReceive()] [F] retrieve protected branches information failed

Strangely, adding files via the web interface does not trigger the error.

@andy0130tw commented on GitHub (Aug 7, 2017): Having exactly the same issue above, when installing the latest docker image backed with SQLite as database, the push never succeeds. Steps to reproduce: 1. Create a repository via the web interface 2. Clone it through HTTPS 3. Make a commit 4. Push and fail with error message "error: failed to push some refs to ..." The log file `/data/log/hooks/pre-receive` is as follows: ``` 2017/08/07 19:49:18 [T] GetProtectedBranchBy: http://localhost:10080/api/internal/branch/1/master 2017/08/07 19:49:18 [...io/gitea/cmd/hook.go:126 runHookPreReceive()] [F] retrieve protected branches information failed ``` Strangely, adding files via the web interface does not trigger the error.
Author
Owner

@lafriks commented on GitHub (Aug 7, 2017):

@andy0130tw can you check if your app.ini has secret token value set?

@lafriks commented on GitHub (Aug 7, 2017): @andy0130tw can you check if your app.ini has secret token value set?
Author
Owner

@andy0130tw commented on GitHub (Aug 8, 2017):

The file seems to be populated upon the install completes. Below is the [security] section on my server, where [...] is omitted for brevity.

[security]
INTERNAL_TOKEN = eyJhb [...] 5a_kk
INSTALL_LOCK   = true
SECRET_KEY     = HL [...] zb
@andy0130tw commented on GitHub (Aug 8, 2017): The file seems to be populated upon the install completes. Below is the `[security]` section on my server, where `[...]` is omitted for brevity. ``` [security] INTERNAL_TOKEN = eyJhb [...] 5a_kk INSTALL_LOCK = true SECRET_KEY = HL [...] zb ```
Author
Owner

@exap commented on GitHub (Aug 28, 2017):

I had this issue too.

I temporarily fixed it by setting this in app.ini:

LOCAL_ROOT_URL  = http://localhost:3000/
@exap commented on GitHub (Aug 28, 2017): I had this issue too. I temporarily fixed it by setting this in `app.ini`: LOCAL_ROOT_URL = http://localhost:3000/
Author
Owner

@RickZeeland commented on GitHub (Nov 30, 2017):

Although the answer by lafriks is probably the correct one:

to call rewrite hooks from admin dashboard

I solved the problem by renaming the Gitea exe to the old name after an update from 1.2.0-RC1 to 1.2.0 on Windows 10.

@RickZeeland commented on GitHub (Nov 30, 2017): Although the answer by lafriks is probably the correct one: > to call rewrite hooks from admin dashboard I solved the problem by renaming the Gitea exe to the old name after an update from 1.2.0-RC1 to 1.2.0 on Windows 10.
Author
Owner

@canyugs commented on GitHub (Dec 14, 2017):

remote: ./hooks/pre-receive.d/gitea: line 2: /app/gitea/gitea: No such file or directory

Same issue, but solved by the answer from lafriks

In admin dashboard you should see something like this and Run it

Resync pre-receive, update and post-receive hooks of all repositories.

@canyugs commented on GitHub (Dec 14, 2017): `remote: ./hooks/pre-receive.d/gitea: line 2: /app/gitea/gitea: No such file or directory` Same issue, but solved by the answer from lafriks In admin dashboard you should see something like this and Run it > Resync pre-receive, update and post-receive hooks of all repositories.
Author
Owner

@lafriks commented on GitHub (Dec 14, 2017):

Closing this issue as answered

@lafriks commented on GitHub (Dec 14, 2017): Closing this issue as answered
Author
Owner

@luusl commented on GitHub (Feb 12, 2018):

I had the same error with the default setting for LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/, using a unix socket.

2018/02/12 10:26:45 [T] GetProtectedBranchBy: unix:///var/run/gitea/gitea.sock:3000/api/internal/branch/1/master
2018/02/12 10:26:45 [...io/gitea/cmd/hook.go:115 runHookPreReceive()] [F] retrieve protected branches information failed

After changing this to LOCAL_ROOT_URL = http://localhost:3000/ it worked.

@luusl commented on GitHub (Feb 12, 2018): I had the same error with the default setting for `LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/`, using a unix socket. ``` 2018/02/12 10:26:45 [T] GetProtectedBranchBy: unix:///var/run/gitea/gitea.sock:3000/api/internal/branch/1/master 2018/02/12 10:26:45 [...io/gitea/cmd/hook.go:115 runHookPreReceive()] [F] retrieve protected branches information failed ``` After changing this to `LOCAL_ROOT_URL = http://localhost:3000/` it worked.
Author
Owner

@randyesq commented on GitHub (May 21, 2019):

Changing LOCAL_ROOT_URL = http://localhost:3000/ did not work for me.

@randyesq commented on GitHub (May 21, 2019): Changing `LOCAL_ROOT_URL = http://localhost:3000/` did not work for me.
Author
Owner

@jtilles commented on GitHub (Aug 14, 2020):

I had this issue when I started to customize my instance.

I needed to copy LFS_JWT_SECRET = <top_secret_key> from my previous app.ini into my new one. Restarted the server, and now it works!

@jtilles commented on GitHub (Aug 14, 2020): I had this issue when I started to customize my instance. I needed to copy `LFS_JWT_SECRET = <top_secret_key>` from my previous app.ini into my new one. Restarted the server, and now it works!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#943