Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Auto-complete not working in bash

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?

like image 940
MysticCode Avatar asked Apr 22 '16 13:04

MysticCode


1 Answers

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
like image 60
CodeWizard Avatar answered Oct 11 '22 07:10

CodeWizard