Terminal showing git_ps1 command not found error every line

So I went through the environment setup (on Linux), and things seemed to be running smoothly. Then I opened up a new Terminal yesterday, and the following lines popped up before seeing a red ~$:

__git_complete: command not found
__git_ps1: command not found

Furthermore, every time I press enter, the second line (__git_ps1: command not found) keeps repeating itself.

When I open ~/.bashrc, I see the following:

load extenstions

source "$HOME/.git-completion.bash"
source “$HOME/.git-prompt.sh”

ENV variables

look for commands in these places

export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="/usr/local/heroku/bin:$PATH"
export PATH="$HOME/.bin:$PATH"

make vim the default text editor

export EDITOR=“vim”

shortened prompt that includes git branch info

RED=’[\e[0;31m]‘
WHITE=’[\e[1;37m]‘
RESET=’[\e[0m]'
export PS1="$RED\w$WHITE$(__git_ps1)$RED$$RESET "

other

initialize rbenv

eval “$(rbenv init -)”

initialize node version manager

export NVM_DIR="$HOME/.nvm"
[ -s “$NVM_DIR/nvm.sh” ] && source “$NVM_DIR/nvm.sh”

load aliases

[[ -f “$HOME/.aliases” ]] && source “$HOME/.aliases”

load any local configuration

[[ -f “$HOME/.bashrc.local” ]] && source “$HOME/.bashrc.local”

I see the line export PS1="$RED\w$WHITE$(__git_ps1)$RED$$RESET ", but I’m not sure if that was a result of installing the dotfiles, or if there are any further changes I need to make to the bash profile in order to avoid these constant error messages.

Thanks!

Hello Jonathan!
Looks like it can’t source the _git__sp1, may be the load extensitions can’t find _git__sp1.
Have you tried to look for .git-completion.bash and .git-prompt.sh to see where these 2 files are located?
Once you know the path, change the path to these 2 files in your .bashrc

Alright, good luck and let me know how things go for you

Hi Thai,

Thanks for your response. I have found the git completion file and sourced that, so now it only displays the _git__ps1 command not found error. I have been googling to try to find the location of the git prompt file with no luck. Do you happen to know where this file tends to be located in Linux?

Thanks again for your help!

Hello Jonathan,

Try look into the folder “git-core”, and source to it.
If you can’t find it, or get the same error after,
you can just reinstall git-core and bash-completion and configure it again, and you should be fine
run "sudo apt-get install git-core bash-completion"
run “bash” to restart your bash
and configure git again

Same error again, then look for git-completion and git prompt again since you have already install git-core and bash-completion.

Good luck and let me know after

1 Like

I have managed to find the git-core folder, as well as source the git-prompt file. It was quite a lengthy learning experience regarding the Home folder vs. the Root folder. Thanks for your help, Thai!

For reference, anyone else using Ubuntu 16.04: the two paths I sourced when editing with the command “gedit .bashrc”:

source "/usr/share/bash-completion/completions/git"
source “/etc/bash_completion.d/git-prompt”

1 Like

Great! You’re welcome! I’m glad you got it working.

1 Like