I'm setting up a new computer, and, among other things, Git with Git Bash. I copied my .bash_aliases
and .gitconfig
from a previous computer, but I can't get Git Bash to source them automatically.
What might I have done wrong ? How to investigate ?
Thanks in advance.
答案1
Actually .bash_aliases
is loaded from .bashrc
. So that is required too. Mine had the following contents :
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
So I copied it over to the new computer. Then upon opening Git Bash again (on the new computer), the following was printed :
WARNING: Found ~/.bashrc but no ~/.bash_profile, ~/.bash_login or ~/.profile.
This looks like an incorrect setup.
A ~/.bash_profile that loads ~/.bashrc will be created for you.
And indeed now there is .bash_profile
with :
# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
And everything works.