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

Gitea ignores path to git binary #8643

Closed
2 of 7 tasks
rmbleeker opened this issue Oct 23, 2019 · 9 comments
Closed
2 of 7 tasks

Gitea ignores path to git binary #8643

rmbleeker opened this issue Oct 23, 2019 · 9 comments

Comments

@rmbleeker
Copy link

  • Gitea version (or commit ref): 1.9.4
  • Git version: 1.8.3.1
  • Operating system: RHEL 7
  • 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:
    N/A

Description

The current version of Git in the RHEL 7 repositories is 1.8.3.1. This version is quite old so I would like to use one of the more recent versions available in the SCL repository. However, SCL packages install everything outside of the regular directories, in /opt/rh. I've set the PATH in the [git] section of my gitea.ini file to point to the git binary (/opt/rh/rh-git218/root/usr/bin/git) but gitea seems to completely ignore this option and keeps using the git version that it finds in it's PATH environment variable, which is /usr/bin/git

@rmbleeker
Copy link
Author

As a work-around I currently set Environment=PATH= in the systemd unit file for gitea to include /opt/rh/rh-git218/root/usr/bin/

@zeripath
Copy link
Contributor

OK, so looking at this - master and 1.9 don't use "git" directly except in one place as a fallback in git.Init and in the install page.

Do you have any more information about when the wrong git is used?

Is it when you're pushing/pulling over SSH because that's the only place I can think that won't use the correct git necessarily?

@rmbleeker
Copy link
Author

@zeripath that's a good question, how can I check? I just went with the information I found on the Configuration page in the site settings, it said "git version 1.8.3.1" there even though I had configured the path to point to the newer version.

@zeripath
Copy link
Contributor

oh that's interesting... Let me have a look again...

@zeripath
Copy link
Contributor

Ah. Found this out - although we use GitExecutable throughout our code, the code to use [git] PATH= is in 1.10 not 1.9.4.

If you cannot use 1.10-rc or master but can recompile gitea you would be able to change the default value from the linker using LDFLAGS="-X "code.gitea.io/gitea/modules/git.GitExecutable=YOUR_PATH""

@zeripath
Copy link
Contributor

FYI #6772 is the PR that provided this function. It would likely be possible to cherry-pick it on to 1.9.4 too.

@zeripath
Copy link
Contributor

As this feature is implemented but not planned to be backported I will close this issue.

@rmbleeker
Copy link
Author

I have it fixed with the work-around right now and can wait for the proper release of 1.10, so no problem.

@zeripath
Copy link
Contributor

Sorry about that! There's definitely an issue with ssh though - I think that needs some more thought. We might have to be putting git on the executable path etc.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants