Autocomplete git in mac OS not working?

后端 未结 6 1577
清歌不尽
清歌不尽 2021-02-01 07:19

I am using git in mac. I am trying to have the autocomplete feature. I followed these steps (http://www.codethatmatters.com/2010/01/git-autocomplete-in-mac-os-x/) but I get this

相关标签:
6条回答
  • 2021-02-01 07:38

    Was getting .git-completion.bash: bash: bad interpreter: No such file or directory in Mountain Lion.

    Should be "source ~/.git-completion.bash" in ~/.bash_profile

    0 讨论(0)
  • 2021-02-01 07:39

    I had tried to use curl -O but the url was wrong and I ended up copying the text which caused the error.

    Using this command made it work perfectly:

    curl -O https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
    

    Thanks a lot everyone for your help!

    0 讨论(0)
  • 2021-02-01 07:39

    From your error report:

    case "$COMP_WORDBREAK'" in
                         ^ the problem is in unpaired apostrophe 
    
    0 讨论(0)
  • 2021-02-01 07:46

    save the file e.g. in gedit with Linux Line-Ending

    0 讨论(0)
  • 2021-02-01 07:49

    The git-completion.bash distributed is a Windows file with "\n\r" as a newline. You need to remove the '\r'.

    For vim users, just do ":set ff=unix".

    0 讨论(0)
  • 2021-02-01 07:51

    Since nobody's answering, quick sanity check: What does bash --version say? OS X tends to ship slightly outdated bashes, so if your system is old, it might be a compatibility thing. I'd expect that Bash 3.x works fine, but with 2.x I'm not so sure.

    0 讨论(0)
提交回复
热议问题