8

I recently installed git. I am using Ubuntu 14.04. However the autocomplete feature is not working.

Whenever I type git i then TAB it should be git init but it doesn't happen so. I have tried everything mentioned in this page, still no success.

Whenever I do git in then TAB it seems like git is pinging unknown host. Below is the screenshot:

enter image description here

How do I resolve this?

Community
  • 1
  • 1
MysticCode
  • 91
  • 1
  • 1
  • 5

1 Answers1

27

Use this script for Ubuntu:

https://github.com/git/git/blob/master/contrib/completion/git-completion.bash

Read the documentation on how to set it up:

 To use these routines:

    1) Copy this file to somewhere (e.g. ~/.git-completion.bash).
    2) Add the following line to your .bashrc/.zshrc:
       source ~/.git-completion.bash
    3) Consider changing your PS1 to also show the current branch,
       see git-prompt.sh for details.

A shorter solution:

# install the bash-completion vai apg-get 
sudo apt-get install git bash-completion
CodeWizard
  • 110,388
  • 20
  • 126
  • 153