Recommended directory to install GoGS to and user to use

Hello everybody,

the description of installation from binaries is quite brief:

  1. Extract the archive.
  2. cd into the directory just created.
  3. Execute ./gogs web and you’re done.

It doesn’t say where to extract the archive and what user should run gogs.

Now I’m running into the “Run user isn’t the current user: git -> root” error, so these questions are not idle. I’ve extracted the archive to a subfolder of /root and I’m trying to run gogs by root. Is it ok to just set the user of gogs to root (in the ...:3000/install web interface) or this would be a security issue? If it is, what user should run it? (via sudo -u username ./gogs web, I believe) I’ve checked the list of users via cat /etc/passwd | cut -d: -f1 and there’s no git or gogs user among them. Should I create one? What rights should it have?

I also suggest that the recommended folder and user to use are described in the installation description.

Hi,

TL;DR All you asked is Linux basics, you can google it.

  1. For non-dev use, try to use daemon (e.g. init, systemd, etc.), not ./gogs web &.
  2. You can run under whatever user, except root (not because you can’t, but you’ll be f*ked up one day…). By convention, Git service uses user git. Create if not exist, default permission with sudo-er if you use daemon.

Ok, here’s how I’ve solved this (just in case somebody else will be searching):

  1. created the git user (adduser git), added sudo rights to it (usermod -aG sudo git)
  2. moved the contents of the extracted archive to /opt/gogs/ following the suggestion here and here
  3. set ownershipt of the folder (cd /opt/, chown -R git:git gogs)
  4. started gogs on behalf of the git user (su - git, ./gogs web; tried sudo -u git ./gogs web before but that didn’t work)

Still I suggest that the recommendation to put the gogs folder to /opt/ and to create the git user if it doesn’t exist is added to the installation description (link in the initial post).

By the way, @Unknwon thanks for the suggestion about using daemon, although I didn’t get why you suggest it only for non-dev use. Isn’t it a measure to make sure that gogs will be running after system reboot or anything like that?

I was curious about running on Glitch (full disclosure I work there) and I get

Run user isn't the current user: app ->

I wonder if it’s because of some of the limits of the Glitch containers? I only have the ability to run things as one user (app). Does it need different users to run the start server command vs. the app itself?

Oh current user was blank, running it as USER=app gogs/gogs web worked!