Gitea: hardcoded gitea executable name

Created on 20 Jun 2018  路  12Comments  路  Source: go-gitea/gitea

  • 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.

kinquestion

Most helpful comment

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

All 12 comments

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.

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.

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.

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

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>

Thanks, latest gitea 1.4.3 seems to be working.

sorry, i made mistake, still bug exist.

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

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

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'

im using windows, what can i do?

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kifirkin picture kifirkin  路  3Comments

jonasfranz picture jonasfranz  路  3Comments

jakimfett picture jakimfett  路  3Comments

Fastidious picture Fastidious  路  3Comments

haytona picture haytona  路  3Comments