Skip to main content

Simple tool to create virtual git environments (like a python's venv).

Project description

gitvenv

Tool to manage multiple Git environments.

Strongly based on python's venv module.

gitvenv defines four environment variables to make the environment work:

  • GIT_VIRTUAL_ENV – a convenience variable pointing to the environment directory.
  • GIT_CONFIG_GLOBAL – tells Git to use config from the environment.
  • GIT_VIRTUAL_ENV_SSH_CONFIG – a convenience variable pointing to SSH config.
  • GIT_SSH_COMMAND – tells Git to use SSH command with config from the environment: $GIT_SSH -F /path/to/env/ssh_config. If GIT_SSH is undefined, ssh will be used instead.

Installation

Using pip

pip install gitvenv

Using AUR

git clone https://aur.archlinux.org/python-gitvenv.git
cd python-gitvenv/
makepkg -si

Using Git

git clone https://gitlab.com/yataro/gitvenv.git
cd gitvenv/
pip install .

Usage

usage: gitvenv [-h] [--clear] [--copy] ENV_DIR

Creates a virtual Git environment in the target directory.

positional arguments:
  ENV_DIR     A directory to create the environment in.

options:
  -h, --help  show this help message and exit
  --clear     Delete the contents of the environment directory if it already exists, before environment creation.
  --copy      Copy the current config files to the new environment.

Once an environment has been created, you may wish to activate it, e.g. by sourcing an activate script in its bin directory.

bash and PowerShell are currently supported:

bash

gitvenv my_env/
source my_env/bin/activate

# Use environment
git config --global user.name 'John Doe'
git config --global user.email 'john@example.com'

# Deactivate environment
gitvenv_deactivate

PowerShell

gitvenv my_env/
.\my_env\bin\Activate.ps1

# Use environment
git config --global user.name 'John Doe'
git config --global user.email 'john@example.com'

# Deactivate environment
gitvenv_deactivate

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

gitvenv-1.0.3.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

gitvenv-1.0.3-py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page