A couple of git command lines…

I'm preserving these here so that I don't forget to them some more.

echo "# non-global:"
git config -l | sed -e 's/=/ "/' -e 's/$/"/' \
    -e 's/^/git config --replace-all /'

echo "# global:"
git config --global -l | sed -e 's/=/ "/'    \
    -e 's/$/"/' -e 's/^/git config --global --replace-all /'

And the output looks like this:

# non-global:
git config --replace-all user.name "Paul Prince"
git config --replace-all user.email "paul@littlebluetech.com"
# global:
git config --global --replace-all user.name "Paul Prince"
git config --global --replace-all user.email "paul@littlebluetech.com"

Of course, to get exactly that output, I had to remove some private data relating to my GitHub account:

echo "# non-global:"
git config -l | sed -e 's/=/ "/' -e 's/$/"/'                  \
    -e 's/^/git config --replace-all /' |                     \
    grep -v github

echo "# global:"
git config --global -l | sed -e 's/=/ "/'                     \
    -e 's/$/"/' -e 's/^/git config --global --replace-all /'| \
    grep -v github

Epilogue

So why doesn't git-config accept its own output format as input?

Navigation
Print/export
Toolbox