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

Allow a different user running GOGS in Docker #7710

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

feed3r
Copy link

@feed3r feed3r commented Mar 31, 2024

At the moment the user running Gogs is git, although this is valid for the vast majority of the cases, there are situations where a different user needs to be configured.

For example: we need that a repository in Gogs is synchronized with an existing git repository in which user git is already used and allow only the commits coming from Gogs repository. In this case we need a specific user name different from the standard one.

PLEASE NOTE:

It's very important to notice that the user written in the app.ini configuration file (created during the gogs installation) must be consistent with the user set in the GOGS_USER environment variable.
Actually, this is completely left to the user, who must be aware to set the very same user.

As a future fix, it would be good to prefill the user input box in the installation screen with the value of the passed GOGS_USER.

Link to the issue: "n/a"

luca-c-xcv and others added 6 commits March 31, 2024 10:34
Allow to specify user running Gogs in a Docker container. Username is
specified through an environment variable passed at the container launch
Added a check on the existence of the user, if it exists the creation process will be skipped otherwise the user will be created.
In case the user is created a rule will also be added to the ssh server configuration file to allow access
Manage the User home directory for a customized user name
fixed the issue by removing the folder creation with the variable
$USER_HOME that was set as '~username'
changed the link between /data/git and /home/username to /data/username and
/home/username to maintain compliance
Use id -u and id -g to assign the correct user_id and group_id for the passed user
@feed3r feed3r requested a review from unknwon as a code owner March 31, 2024 18:16
Instead of using cat file | grep "string", directly use grep "string" file

Automatically checked by deepsource
@feed3r feed3r force-pushed the main branch 2 times, most recently from b7e99bc to 691b98d Compare March 31, 2024 20:22
Use double quote to prevent globbing and word splitting SH-2086, as mentioned by deepsource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants