Git 자동 완성 기능이 Homebrew와 작동하지 않습니다


12

내 설정은 다음과 같습니다.

brew install git bash-completion
Warning: git-2.1.3 already installed
Warning: bash-completion-1.3 already installed

.bash_profile에서 :

if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
fi

그러나 여전히 git 명령에 대한 자동 완성 기능이 없습니다. (이전에 macports를 사용했지만 시도한 결과에 상관없이 git 명령을 자동 완성 할 수 없기 때문에 완전히 제거했습니다.)

OSX 10.10에 있습니다

답변:


10

Yosemite의 경우 homebrew를 사용하여 git 2.1.3으로 업그레이드 한 후에도 내 .profile파일 에서 작동했습니다 ( .bash_profile또는 이와 유사한 것).

# git tab completion (homebrew)
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then
    . `brew --prefix`/etc/bash_completion.d/git-completion.bash
fi

나는 git-prompt.sh거기에 있었지만 그것을 변경 git-completion.bash하여 나를 위해 일했습니다. ymmv.


3

홈 디렉토리에서 직접 다운로드하십시오.

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

그런 다음 다음을 .bash_profile추가하십시오.

if [ -f ~/.git-completion.bash ]; then
    . ~/.git-completion.bash
fi

1
wget https://raw.github.com/git/git/master/contrib/completion/git-completion.bash && source git-completion.bash아직 운 이 없었습니다.
— qed

@ qed, 그 + 답변의 .bash_profile이 나를 위해 일했습니다.
— Maragues

. ~/.git-completion.bash껍질 에도 직접 작동하지 않습니다. 오류 메시지도 없습니다.
— qed

1

내 시스템 (10.10.5)에서 /usr/local/etc/bash_completion.d/에 심볼릭 링크를 GIT 디렉토리의 bash_completion.d / git-completion.bash에 작성하여이 문제를 해결했습니다. 나의 경우에는:

cd /usr/local/etc/bash_completion.d
ln -s ../../Cellar/git/2.7.2/etc/bash_completion.d/git-completion.bash git-completion.bash

설치된 git 버전을 체크 아웃하고 2.7.2를 버전으로 바꾸십시오.


나는 이미 그것을 가지고 있지만 여전히 작동하지 않습니다.
— qed

다른 답변과 함께이 작업도 저에게 효과적이었습니다. 감사!
— Vandesh
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.