Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
share|improve this question
    
The Pseudo-terminal... error is nearly always seen in the context of ssh (if you search Launchpad and Ubuntuforums); perhaps there is something in your environment or in your .bashrc like an alias, function or some variable that is causing the trouble. –  user76204 Nov 6 '12 at 18:13
    
After testing your setup with the files provided, I can't seem to reproduce the problem; I assume you haven't got a .bash_aliases file, as it's not sourced in .bashrc. –  user76204 Nov 6 '12 at 19:06
    
@Mik The ~/.bash_aliases file was the problem I narrowed it down to the alias line alias test="ssh [email protected]". Commenting out that line fixes the problem, thank you. –  soldier.moth Nov 6 '12 at 19:39
    
Great- I'll put it as an answer. –  user76204 Nov 6 '12 at 19:40

1 Answer 1

up vote 3 down vote accepted
+50

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 [email protected]"

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.

share|improve this answer
    
any idea why git tab completion runs test? –  soldier.moth Nov 6 '12 at 19:53
    
@Soldier.moth I'm not sure- it's an interesting one; I'll see if I can find out. –  user76204 Nov 6 '12 at 19:56
    
in the version of git that came with ubuntu 11.04(1.7.4.1) there wasn't any use of test in the auto completion script but in the git that comes with ubuntu 12.10(1.7.10.4) it does 1.7.4.1 auto completion script –  soldier.moth Nov 6 '12 at 20:09
    
@Soldier.moth I see now, that's useful to remember. –  user76204 Nov 6 '12 at 20:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.