hardcoded gitea executable name #1953

Closed
opened 2025-11-02 04:18:59 -06:00 by GiteaMirror · 12 comments
Owner

Originally created by @sailfish009 on GitHub (Jun 20, 2018).

  • Gitea version (or commit ref): a93f138
  • Git version: 2.17.1
  • Operating system: win10 64bit
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • [ v] SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [v ] Not relevant
  • Log gist:

Description

Hi, when i git push, i get following error messages:
git push origin master

remote: ./hooks/pre-receive.d/gitea: line 2: C:/Git/gitea-1.4.1-windows-4.0-amd64.exe: No such file or directory
To http://localhost:3000/user/repo
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://localhost:3000/user/repo'

i had replace gitea-1.4.1-*.exe with latest gitea-master-windows-4.0-amd64.exe and renamed it to "gitea.exe".

i think this should be no problem.

Originally created by @sailfish009 on GitHub (Jun 20, 2018). - Gitea version (or commit ref): a93f138 - Git version: 2.17.1 - Operating system: win10 64bit - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ v] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [v ] Not relevant - Log gist: ## Description Hi, when i git push, i get following error messages: git push origin master remote: ./hooks/pre-receive.d/gitea: line 2: C:/Git/gitea-1.4.1-windows-4.0-amd64.exe: No such file or directory To http://localhost:3000/user/repo ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'http://localhost:3000/user/repo' i had replace gitea-1.4.1-*.exe with latest gitea-master-windows-4.0-amd64.exe and renamed it to "gitea.exe". i think this should be no problem.
GiteaMirror added the type/question label 2025-11-02 04:18:59 -06:00
Author
Owner

@aisbergg commented on GitHub (Jun 20, 2018):

I had a similar problem when I migrated from Gogs to Gitea. The solution was to change the git hooks manually. The hooks are stored in .../repositories/USERNAME/REPO/hooks, so every repo of every user must be edited. You will need to write a simple search&replace script to do that for you.
In every hooks folder there are three files that need to be edited. Those are:

  • pre-receive.d/gitea
  • post-receive.d/gitea
  • update.d/gitea

These contain the old path of you binary, which of course need to be change to reflect the new path of the gitea binary file.

@aisbergg commented on GitHub (Jun 20, 2018): I had a similar problem when I migrated from Gogs to Gitea. The solution was to change the git hooks manually. The hooks are stored in `.../repositories/USERNAME/REPO/hooks`, so every repo of every user must be edited. You will need to write a simple search&replace script to do that for you. In every `hooks` folder there are three files that need to be edited. Those are: - `pre-receive.d/gitea` - `post-receive.d/gitea` - `update.d/gitea` These contain the old path of you binary, which of course need to be change to reflect the new path of the gitea binary file.
Author
Owner

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

Go to admin panel in UI and run Update the '.ssh/authorized_keys' file with Gitea SSH keys. (Not needed for the built-in SSH server.). That's because you have moved your binary after you run.

@lunny commented on GitHub (Jun 20, 2018): Go to admin panel in UI and run `Update the '.ssh/authorized_keys' file with Gitea SSH keys. (Not needed for the built-in SSH server.)`. That's because you have moved your binary after you run.
Author
Owner

@sailfish009 commented on GitHub (Jun 20, 2018):

when i running command in admin panel UI, (Update the '.ssh/authorized_keys' file with Gitea SSH keys. (Not needed for the built-in SSH server.)
i got following error message, still have a problem ATM.

rename C:\Users\user\.ssh\authorized_keys.tmp C:\Users\user\.ssh\authorized_keys: The process cannot access the file because it is being used by another process.

@sailfish009 commented on GitHub (Jun 20, 2018): when i running command in admin panel UI, (Update the '.ssh/authorized_keys' file with Gitea SSH keys. (Not needed for the built-in SSH server.) i got following error message, still have a problem ATM. `rename C:\Users\user\.ssh\authorized_keys.tmp C:\Users\user\.ssh\authorized_keys: The process cannot access the file because it is being used by another process.`
Author
Owner

@lafriks commented on GitHub (Jun 20, 2018):

Maybe you have opened that file to see it's content and have not closed it?

@lafriks commented on GitHub (Jun 20, 2018): Maybe you have opened that file to see it's content and have not closed it?
Author
Owner

@ealib commented on GitHub (Jun 25, 2018):

I usually don't rename it, but I link it:

D:\> cd gitea
D:\gitea\> dir
 Volume in drive D is XXXXXXXXXXXXXXXXXX
 Volume Serial Number is XXXX-XXXX

 Directory of D:\gitea

09/06/2018  11:36    <DIR>          .
09/06/2018  11:36    <DIR>          ..
26/02/2018  16:41    <DIR>          custom
26/02/2018  16:59    <DIR>          data
07/05/2018  09:38        49,332,587 gitea-1.4.1-windows-4.0-amd64.exe
07/06/2018  15:59        49,343,370 gitea-1.4.2-windows-4.0-amd64.exe
03/04/2018  15:07       659,518,081 gitea-dump-1522760708.zip
09/06/2018  11:36    <SYMLINK>      gitea.exe [gitea-1.4.2-windows-4.0-amd64.exe]
26/02/2018  16:47    <DIR>          indexers
19/02/2018  18:52         9,966,592 lgtm-1.0.0-windows-amd64.exe
26/02/2018  16:29    <SYMLINK>      lgtm.exe [lgtm-1.0.0-windows-amd64.exe]
21/06/2018  12:11    <DIR>          log
               6 File(s)    768,160,630 bytes
               6 Dir(s)  286,789,558,272 bytes free

D:\gitea>

To create a link, simply use mklink:

D:\gitea> mklink

  Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    Specifies the new symbolic link name.
        Target  Specifies the path (relative or absolute) that the new link
                refers to.

D:\gitea>
@ealib commented on GitHub (Jun 25, 2018): I usually don't rename it, but I link it: ```cmd D:\> cd gitea D:\gitea\> dir Volume in drive D is XXXXXXXXXXXXXXXXXX Volume Serial Number is XXXX-XXXX Directory of D:\gitea 09/06/2018 11:36 <DIR> . 09/06/2018 11:36 <DIR> .. 26/02/2018 16:41 <DIR> custom 26/02/2018 16:59 <DIR> data 07/05/2018 09:38 49,332,587 gitea-1.4.1-windows-4.0-amd64.exe 07/06/2018 15:59 49,343,370 gitea-1.4.2-windows-4.0-amd64.exe 03/04/2018 15:07 659,518,081 gitea-dump-1522760708.zip 09/06/2018 11:36 <SYMLINK> gitea.exe [gitea-1.4.2-windows-4.0-amd64.exe] 26/02/2018 16:47 <DIR> indexers 19/02/2018 18:52 9,966,592 lgtm-1.0.0-windows-amd64.exe 26/02/2018 16:29 <SYMLINK> lgtm.exe [lgtm-1.0.0-windows-amd64.exe] 21/06/2018 12:11 <DIR> log 6 File(s) 768,160,630 bytes 6 Dir(s) 286,789,558,272 bytes free D:\gitea> ``` To create a link, simply use **mklink**: ```cmd D:\gitea> mklink Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file symbolic link. /H Creates a hard link instead of a symbolic link. /J Creates a Directory Junction. Link Specifies the new symbolic link name. Target Specifies the path (relative or absolute) that the new link refers to. D:\gitea> ```
Author
Owner

@sailfish009 commented on GitHub (Jun 27, 2018):

Thanks, latest gitea 1.4.3 seems to be working.

@sailfish009 commented on GitHub (Jun 27, 2018): Thanks, latest gitea 1.4.3 seems to be working.
Author
Owner

@sailfish009 commented on GitHub (Jun 27, 2018):

sorry, i made mistake, still bug exist.

@sailfish009 commented on GitHub (Jun 27, 2018): sorry, i made mistake, still bug exist.
Author
Owner

@aisbergg commented on GitHub (Jun 27, 2018):

Did you try to execute the Resync pre-receive, update and post-receive hooks of all repositories. operation in the dashboard already?

@aisbergg commented on GitHub (Jun 27, 2018): Did you try to execute the `Resync pre-receive, update and post-receive hooks of all repositories.` operation in the dashboard already?
Author
Owner

@sailfish009 commented on GitHub (Jun 28, 2018):

Thanks! @Aisbergg
i renamed latest gitea executable to gitea.exe and run it.
and run your recommended command, and it works.

@sailfish009 commented on GitHub (Jun 28, 2018): Thanks! @Aisbergg i renamed latest gitea executable to gitea.exe and run it. and run your recommended command, and it works.
Author
Owner

@varhub commented on GitHub (Oct 3, 2019):

Same issue one year later. I let attached a script for future people like me:

#!/bin/sh
# 2019.10.03 varribas

set -e
set -u

OLD_VERSION='gitea-1.7.6-windows-4.0-amd64.exe'
NEW_VERSION='gitea-current.exe'

cd user-data  # where repositories are stored

echo 'Affected files:'
grep -lR "$OLD_VERSION"

grep -lR "$OLD_VERSION" \
| xargs -r \
  sed -i "s,$OLD_VERSION,$NEW_VERSION,g"


echo 'REMEMBER TO CREATE SYMBOLIC LINK'
echo '$ mklink gitea-current.exe gitea-1.9.3-windows-4.0-amd64.exe'
@varhub commented on GitHub (Oct 3, 2019): Same issue one year later. I let attached a script for future people like me: ``` #!/bin/sh # 2019.10.03 varribas set -e set -u OLD_VERSION='gitea-1.7.6-windows-4.0-amd64.exe' NEW_VERSION='gitea-current.exe' cd user-data # where repositories are stored echo 'Affected files:' grep -lR "$OLD_VERSION" grep -lR "$OLD_VERSION" \ | xargs -r \ sed -i "s,$OLD_VERSION,$NEW_VERSION,g" echo 'REMEMBER TO CREATE SYMBOLIC LINK' echo '$ mklink gitea-current.exe gitea-1.9.3-windows-4.0-amd64.exe' ```
Author
Owner

@HoomanJCode commented on GitHub (Oct 1, 2020):

im using windows, what can i do?

@HoomanJCode commented on GitHub (Oct 1, 2020): im using windows, what can i do?
Author
Owner

@zeripath commented on GitHub (Oct 1, 2020):

https://github.com/go-gitea/gitea/issues/4278#issuecomment-400657605

Run the Resync pre-receive, update and post-receive hooks of all repositories. operation in the dashboard.

@zeripath commented on GitHub (Oct 1, 2020): https://github.com/go-gitea/gitea/issues/4278#issuecomment-400657605 Run the `Resync pre-receive, update and post-receive hooks of all repositories.` operation in the dashboard.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1953