Skip to content

Instantly share code, notes, and snippets.

@Jak12-3
Forked from acidtone/README.md
Created April 14, 2024 12:41
Show Gist options
  • Select an option

  • Save Jak12-3/c38c88ec62c4fd012a9104e5aa24a43d to your computer and use it in GitHub Desktop.

Select an option

Save Jak12-3/c38c88ec62c4fd012a9104e5aa24a43d to your computer and use it in GitHub Desktop.
Git Activity: Configure a global .gitignore file

Configure a Global .gitignore file

.gitignore files list files and directories that Git shouldn't include when adding/committing to repos. These include files that your operating system uses to function properly (like file icons and display settings).

Complete the following steps to set your global .gitignore file for all repos on your system.

These steps were taken from: Configuring ignored files for all repositories on your computer

  1. Is your global .gitignore file already set up? The following shell command will print your settings for your .gitignore:

    $ git config core.excludesfile
    

    If nothing happens, you need to set your excludes file.

  2. Using VS Code (or similar) save a .gitignore_global file to your home directory (usually in /Users/username or similar). In this file, paste the contents of the excludesfile file listed in this Gist. It includes files and directories for Windows, Mac and Linux.

  3. The following shell command will save your .gitignore_global file in your settings:

    $ git config --global core.excludesfile ~/.gitignore_global
    
  4. Repeat Step 1 to confirm your settings were saved correctly.

And that's it! You will need to complete these steps for any computer you plan to use with Git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment