Skip to content

Instantly share code, notes, and snippets.

@angela-d
Created March 30, 2018 02:29
Show Gist options
  • Save angela-d/2a2f49e5eef8d40fa242569221f46e7d to your computer and use it in GitHub Desktop.
Save angela-d/2a2f49e5eef8d40fa242569221f46e7d to your computer and use it in GitHub Desktop.
Recursively find & replace .git/config data in Linux

Find & Replace content in your .git/config recursively

Useful for when you change handles or mistakenly run a global config command.

In your terminal, run:

sed -i -e 's/find_this/replace_this/g' ~/Github/angela-d/*/.git/config

Replace find_this with the entry you want to change

replace_this is the entry you want to replace find_this with

Swap out

~/Github/angela-d/*/.git/config

for the directory you want the command to run through.

For example /home/angela/Github is where I store my local Github repos, so I use the * wildcard to initiate changes in every repository.

Easy. 😎

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