Command Line

To run gitignore.io from your command line you need an active internet connection and an environment function. You need to add a function to your environment that lets you access the gitignore.io API.

Git

Bash

git config --global alias.ignore \
'!gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}; gi'

Linux

Bash

echo "function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/\$@ ;}" >> \
~/.bashrc && source ~/.bashrc

Zsh

echo "function gi() { curl -sLw \"\\\n\" https://www.toptal.com/developers/gitignore/api/\$@ ;}" >> \
~/.zshrc && source ~/.zshrc

Fish

printf "function gi\n\tcurl -sL https://www.toptal.com/developers/gitignore/api/\$argv\nend\n" > \
~/.config/fish/functions/gi.fish

macOS

Bash

Zsh

Fish

Windows

Paste the following scripts inside your PowerShell profile (run $profile inside PowerShell to get the profile's location path).

PowerShell v3 Script

PowerShell v2 Script

Create a Command Line Prompt Script If you have installed msysgit), create gi.cmd with content below. And copy it to C:\Program Files\Git\cmd\gi.cmd, assuming msysgit was installed to c:\Program Files\Git. Make sure that C:\Program Files\Git\cmd is added to the environment variable path.

Last updated

Was this helpful?