6

I had git previously installed using ubuntu apt-get installed. Recently uninstalled it and installed git from source to get version 1.8.4 .

However now whenever I open a new termial on Ubuntu, I get the following error:

-bash: /usr/lib/git-core/git-sh-prompt: No such file or directory

I have tried to search various bash start files like .bashrc , .bash_profile or .profile, but can't find any reference to any git based setup.

How can I remove this error. I do not have /usr/lib/git_core folder, but do have /usr/libexec/git-core folder.

4

3 回答 3

8

Purging the git packages solves the problem:

sudo apt-get purge git

Gives:

$ sudo apt-get purge git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  git*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? 
(Reading database ... 103069 files and directories currently installed.)
Removing git ...
Purging configuration files for git ...
于 2013-08-28T17:35:06.060 回答
3
Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726669
Ubuntu: https://bugs.launchpad.net/ubuntu/+source/git/+bug/1196510
Mint:   forums.linuxmint.com/viewtopic.php?f=47&t=135218

您应该能够从 /etc/bash_completion.d/git-prompt 中注释“./usr/lib/git-core/git-sh-prompt”或执行 Debian Jessie 所做的操作并检查文件是否存在.

以下是 Jessie 的完整 /etc/bash_completion.d/git-prompt:

# In git versions < 1.7.12, this shell library was part of the
# git completion script.
#
# Some users rely on the __git_ps1 function becoming available
# when bash-completion is loaded.  Continue to load this library
# at bash-completion startup for now, to ease the transition to a
# world order where the prompt function is requested separately.
#
if [[ -e /usr/lib/git-core/git-sh-prompt ]]; then
        . /usr/lib/git-core/git-sh-prompt
fi
于 2014-02-11T18:01:04.040 回答
3

目录 /etc/bash_completion.d 中有一个文件git*试图访问/usr/lib/git-core/git-sh-prompt,可能来自以前的安装。

尝试删除git*然后从源重新安装

rm -rf /etc/bash_completion.d/git
于 2013-08-26T19:58:23.360 回答