Default snap permissions trigger failure when /etc/gitconfig exists

Checklist

  • I'm using the latest version of the extension (Run glab --version)
    • Extension version: Put your extension version here
  • Operating system and version: Ubuntu Linux 24.10
  • Gitlab.com or self-managed instance? gitlab.com
  • GitLab version (if self-managed) glab 1.56.0 (6f8bb1f5) (Use the version endpoint, like this: gitlab.my-company.com/api/v4/version)
  • I have performed glab auth status to check for authentication issues
  • Run the command in debug mode (like DEBUG=true glab mr list) and attach any useful output

Summary

When using the Snapcraft store version of Gitlab CLI, it is not allowed to access certain files under /etc, however, it is able to detect their presence. This causes it to try to access /etc/gitconfig which fails with permission denied and prevents normal functionality of the program as it exits due to unreadable configuration files. The workaround is to move that config file out of the way on the host system. The full session is seen here:

$ GITLAB_HOST=gitlab.com DEBUG=true glab repo clone gitlab-org/cli
[git remote -v]
2025/04/28 00:48:37 [Args: gitlab-org/cli]
2025/04/28 00:48:37 [GitFlags: ]
2025/04/28 00:48:37 [Dir: ]
[git clone git@gitlab.com:gitlab-org/cli.git]
warning: unable to access '/etc/gitconfig': Permission denied
warning: unable to access '/etc/gitconfig': Permission denied
fatal: unknown error occurred while reading the configuration files
ERROR: exit status 128

Less severe, but a similar error is seen with using the SSH protocol on clone after removing the config file. This is not as critical as regular git can be used instead.

$ GITLAB_HOST=gitlab.com DEBUG=true glab repo clone gitlab-org/cli
[git remote -v]
[git config --get-regexp ^remote\..*\.glab-resolved$]
2025/04/28 01:03:35 [Args: gitlab-org/cli]
2025/04/28 01:03:35 [GitFlags: ]
2025/04/28 01:03:35 [Dir: ]
[git clone git@gitlab.com:gitlab-org/cli.git]
Cloning into 'cli'...
warning: templates not found in /usr/share/git-core/templates
fatal: cannot exec 'ssh': Permission denied
fatal: unable to fork
ERROR: exit status 128

Environment

  • OS: Linux 6.11.0-21-generic x86_64
  • SHELL: /bin/bash
  • TERM: tmux
  • GLAB: glab 1.56.0 (6f8bb1f5)

Other:

Steps to reproduce

Create an empty config file if one doesn't exist:

touch /etc/gitconfig

Run any CLI command that talks to the API:

git issue list

What is the current bug behavior?

It

What is the expected correct behavior?

warning: unable to access '/etc/gitconfig': Permission denied
warning: unable to access '/etc/gitconfig': Permission denied
fatal: unknown error occurred while reading the configuration files
ERROR: exit status 128

Relevant logs and/or screenshots

Valid command output.

Possible fixes

The snap permissions should be modified to allow access to /etc/gitconfig or failure to read it should be non-fatal.