Ubuntu – Git autocomplete is asking for a password, not sure why

12.10bashgit

I'm running into an issue with autocomplete using git…
I am using ubuntu 12.10 and
when I perform the following keystrokes

g i t Space Bar Tab

I am presented with the error

Pseudo-terminal will not be allocated because stdin is not a
terminal.

and prompted for a password. I am not clear how to go about troubleshooting this error, I have tried uninstalling and reinstalling git to no avail.

Screenshot of terminal with error: terminal with error

Diff between /root/.bashrc & ~/.bashrc

3a4
> export JAVA_HOME="/usr/lib/jvm/java-6-sun"
21a23,25
> JAVA_HOME="/usr/lib/jvm/java-6-sun"
> export JAVA_HOME
> 
51a56,63
> git_prompt()
> {
>   git_branch=$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p')
>   if [ -n "$git_branch" ]; then
>       echo "($git_branch)"
>   fi
> }
> 
53c65
<     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
---
>     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(git_prompt)\$ '
55c67
<     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
---
>     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(git_prompt)\$ '
84a97,100
> # Add an "alert" alias for long running commands.  Use like so:
> #   sleep 10; alert
> alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
> 
97,99c113,115
< #if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
< #    . /etc/bash_completion
< #fi
---
> if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
>     . /etc/bash_completion
> fi

Best Answer

After discussing in the comments about possible solutions to do with possibles aliases in .bashrc and anomalous environmental variables, we came to the conclusion that the problem lay in the .bash_aliases file, which contained the line:

alias test="ssh username@some.server.com"

This was logical, as I tested the .bashrc provided and it worked perfectly without the error occuring, so the problem had to lay in another file.

This confirmed my initial suspicion that the issue was something to do with ssh, as the error:

Pseudo-terminal will not be allocated because stdin is not a terminal

only occurs when ssh is concerned, as noted here at Ubuntu forums and here at Stackoverflow. Therefore it seemed that there was no bug in bash autocomplete or git, and so the problem was discovered.

Related Question