Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Hooks are broken when you move gitea to another folder #605

Closed
2 of 6 tasks
cookiengineer opened this issue Jan 7, 2017 · 3 comments
Closed
2 of 6 tasks
Labels
issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea

Comments

@cookiengineer
Copy link

cookiengineer commented Jan 7, 2017

  • Gitea version: 1.0.1
  • Git version: ?
  • Operating system: Arch Linux ARM, up-to-date
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

Problem Description / Error Message

  1. You can clone, pull whatever. SSH properly setup and blabla.
  2. Error message on push is the following (where git-mirror is the host for the machine).
[lycheejs] (development)$ git push mirror development
Counting objects: 80, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (76/76), done.
Writing objects: 100% (80/80), 15.28 KiB | 0 bytes/s, done.
Total 80 (delta 50), reused 0 (delta 0)

# XXX: Note this /home/alarm/gitea path, this is the outdated update hook path
remote: hooks/update: line 2: /home/alarm/gitea: Permission denied

remote: error: hook declined to update refs/heads/development
To git-mirror:Artificial-Engineering/lycheejs.git
 ! [remote rejected] development -> development (hook declined)
error: failed to push some refs to 'git@git-mirror:Artificial-Engineering/lycheejs.git'

Steps to reproduce

  1. Installed gitea to /home/alarm to experiment around, start it and configure it.
  2. Setup correct git user account.
  3. Later moved things to /opt/gitea because I have an external HDD mount there (running on a Raspberry Pi 2).
  4. Everything was configurable and modifyable in the custom/conf/app.ini
  5. EXCEPT the update hooks. Those contain static paths to the old binary.

Quickfix for others

I made a little script that assumes the ./gitea-repositories folder is in the same folder as the gitea binary and that fixes all update hooks once run. In my case it's located in /opt/gitea/fix_repos.js where repos are in /opt/gitea/gitea-repositories. Link to the fix_repos.js script.

Problems caused

I saw a couple issues in upstream gogs where people had the same problems. It is totally unclear that you cannot move around gitea because I would assume that a binary can be copy/pasted with its config files and it should work isolated in that folder.

Suggestion

Maybe it makes sense to have a bootup routine that does a sanity checks for all update hooks when the gitea web service is started. So that it just makes sure that all paths are up to date and point to the correct binary.

@lunny
Copy link
Member

lunny commented Jan 7, 2017

Enter Gitea admin panel on the UI, run Rewrite '.ssh/authorized_keys' file (caution: non-Gitea keys will be lost) and Rewrite all update hook of repositories (needed when custom config path is changed).

@tboerger
Copy link
Member

Since the data is a static part it must be rewritten within the admin ui.

@ve3
Copy link
Contributor

ve3 commented Apr 30, 2019

First I try to push git but get this error.

[remote rejected] master -> master (pre-receive hook declined)

I run Update the '.ssh/authorized_keys' file with Gitea SSH keys. (Not needed for the built-in SSH server.) but got error.

open C:\Windows\system32\config\systemprofile.ssh\authorized_keys.tmp: The system cannot find the path specified.

Then I run Resynchronize pre-receive, update and post-receive hooks of all repositories.

And I try to push again and everything works fine.

I'm not sure is that for this or update .ssh/authorized_keys work even it display error or something but it work! I don't know why.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
@delvh delvh added issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea and removed reviewed/invalid labels Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/not-a-bug The reported issue is the intended behavior or the problem is not inside Gitea
Projects
None yet
Development

No branches or pull requests

5 participants