Git Cheat Sheet/Trust repository path

Allow Git to operate in a repository path marked safe.

Section: Setup and Configuration

Trust repository path

bash
bash
git config --global --add safe.directory /path/to/repo

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Setup and Configuration
Set global user name
Set default author name.
OpenIn sheetbashsame section
Set global email
Set default author email.
OpenIn sheetbashsame section
Set default editor
Choose editor for commit messages and interactive rebase.
OpenIn sheetbashsame section
Set default branch name
Use main for new repositories.
OpenIn sheetbashsame section
Set pull to rebase by default
Avoid merge commits on pull.
OpenIn sheetbashsame section
Enable rerere
Reuse recorded resolution for repeated conflicts.
OpenIn sheetbashsame section