Installation

How to install gitcd.

Installation of gitcd

Pre requisites

Gitcd is written in Python3. Most systems still deliver with Python2 as default. You need to install Python3 in order to run gitcd properly.

MacOSX

brew install python3

Ubuntu / Debian

sudo apt-get install python3 python3-pip

Installation of gitcd itself

Now you are ready to install gitcd itself, which is quite easy using pip.

pip3 install --user --upgrade gitcd

Trouble using git-cd?

If the command "git-cd" or "git cd" is not available now, you probably need to add the pip binary path to your $PATH variable.

MacOSX

Open ~/.bash_profile in your favorite editor and add the following lines at the end of the file.

Replace <python-version> with your currently installed python version
if [ -d "$HOME/Library/Python/<python-version>/bin" ] ; then
    PATH="$HOME/Library/Python/<python-version>/bin:$PATH"
fi

Ubuntu / Debian

Open ~/.profile in your favorite editor and add the following lines at the end of the file.

if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Argument Completion

Gitcd supports argument completion, to activate it execute the following steps.

MacOSX

Under OSX it isn't that simple unfortunately. Global completion requires bash support for complete -D, which was introduced in bash 4.2. On OS X or older Linux systems, you will need to update bash to use this feature. Check the version of the running copy of bash with echo $BASH_VERSION. On OS X, install bash via Homebrew (brew install bash), add /usr/local/bin/bash to /etc/shells, and run chsh to change your shell.

You might consider reading the docs for argcomplete https://argcomplete.readthedocs.io/en/latest/#global-completion

Activate Global argcomplete

You are now ready to activate global argcompletion for python with the following command.

activate-global-python-argcomplete

Comments