Mount projects in GitLab as a file system
Project description
gitlabfs
gitlabfs allows you to mount all projects in a company's GitLab instance as a file system.
About
This project was conceived out of a need to easily browse code in many different repositories within a company. While GitLab does have builtin browsing and search, it's just not as convenient to use as common tools like find
and grep
.
It sets out to solve that by exposing an entire GitLab instance as a file system with the following hierarchy:
/
/user
/project
/master
README.md
/feature
/abc
/src
main.py
/v1.0
main.py
/group
/subgroup
/project
This allows you to freely browse all of the code in a GitLab instance without having to clone everything. All of the files are loaded from the GitLab API as you access them. The only caveat is that it is a read-only view.
Installation
Install the latest version of gitlabfs from PyPI:
pip install gitlabfs
Usage
-
Go to your profile page in GitLab and generate a new access token with the
api
scope. -
Create a directory where you would like to access your projects from, e.g.
~/gitlab
. -
Mount GitLab at that directory:
glfs https://gitlab.mycompany.com ~/gitlab
You will be asked to provide your access token and then the GitLab hierarchy will be mounted.
Configuration
Various options can be passed to configure the properties of the file system:
--tags
: Include tags in the list of repository refs.--users
: List user repositories as well.--file-times
: Better approximate file modification times with commit metadata.--cache-expiry=SEC
: Expire the cache after this many seconds (default: 60).--fresh-project-tree
: Enable cache expiry for the project tree.--debug
: Enable verbose logging for development purposes.
Many of these are not enabled by default because they may result in worse performance or more clutter.
The access token must be provided via a command line prompt by default, but can also be passed via the GITLAB_TOKEN
environment variable.
Limitations
- Not designed for GitLab instances with a huge number of projects (e.g. gitlab.com).
- File modification times are not accurate since they are not exposed by the GitLab API.
Development
The file system can be easily run locally with Pipenv:
pipenv install
pipenv run ./glfs <url> <mountpoint> [options]
And the PyPI package is published using the following commands:
pipenv run python setup.py sdist bdist bdist_wheel
pipenv run twine upload dist/*
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gitlabfs-1.1.0.linux-x86_64.tar.gz
.
File metadata
- Download URL: gitlabfs-1.1.0.linux-x86_64.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28e86bcdf34e3095f736bc1065ae1ad7b034479bb657df0f503c21a34ebaec4b |
|
MD5 | 64d2e645a033e2a82dbf740792742def |
|
BLAKE2b-256 | 490a4dd3db4d38ed4d83dfac07575d41819597e94a82e57fdc566afbf12bcc96 |
File details
Details for the file gitlabfs-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: gitlabfs-1.1.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbf7abdf5ec3ec3a065308f66a20c98c3799fe95ef8530a018693d8893943832 |
|
MD5 | 6336763b1ddc9563bf63df4164764dbb |
|
BLAKE2b-256 | f7a5d6494a15162a5202f7357e60baf77f1aa7ca9e11d55dcaae7daec07a05a2 |