title: Running local GitLab CI with shell executor and flag --user $USER for gitlab-runner
body: <p>I try to set up a CI environment on a local GitLab install.
  I am testing basic shell commands that need to be run within the regular user (the value of <code>$USER</code>) environment.
  By default the gitlab-runner service is configured with <code>--user gitlab-runner</code>.
  So first I followed the answer provided at <a href="https://stackoverflow.com/questions/37187899/change-gitlab-ci-runner-user">Change Gitlab CI Runner user</a> to assign another user.
  This seemed to work as the output of <code>ps aux | grep runner</code> is as expected and I hit the <code>clear_console</code> error from <code>.bash_logout</code> described at <a href="https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4559" rel="nofollow noreferrer">https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4559</a>.
  After commenting out the content of <code>.bash_logout</code> I now get the following error.</p>
  <pre><code>Running with gitlab-runner 14.3.2 (e0218c92)
  ...
  Getting source from Git repository
  00:00
  Fetching changes with git depth set to 50...
  error: could not lock config file /home/gitlab-runner/builds/y762gpjf/0/root/test.tmp/git-template/config: Permission denied
  </code></pre>
  <p>This happens before any command from <code>.gitlab-ci.yml</code> gets interpreted so I am stuck here.
  Also it seems that gitlab-runner is definitely not designed to be run with the regular user account. Is that a fair assumption?</p>
  <h3>EDIT: solution implemented based on the answers</h3>
  <p>Indeed, the new user did not have access to the working directory of the runner.
  So before installing the runner I ran</p>
  <pre><code>sudo usermod -aG gitlab-runner $USER
  sudo chmod g+wx /home/gitlab-runner/
  </code></pre>
  <p>and then</p>
  <pre><code>sudo gitlab-runner install --user=$USER --working-directory=/home/gitlab-runner
  </code></pre>