我之前使用ubuntu apt-get安装了git。 最近卸载了它并从源代码安装了git以获得1.8.4版本。
但是现在每当我在Ubuntu上打开一个新的termial时,我都会收到以下错误:
-bash: /usr/lib/git-core/git-sh-prompt: No such file or directory
我试图搜索各种bash启动文件,如.bashrc,.bash_profile或.profile,但找不到任何基于git的设置的引用。
如何删除此错误。我没有/ usr / lib / git_core文件夹,但有/ usr / libexec / git-core文件夹。
答案 0 :(得分:8)
清除git包解决了这个问题:
sudo apt-get purge git
给出:
$ 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 ...
答案 1 :(得分:3)
目录/etc/bash_completion.d中有一个文件git*
,它试图访问/usr/lib/git-core/git-sh-prompt
,可能来自之前的安装。
尝试删除git*
,然后从源
rm -rf /etc/bash_completion.d/git
答案 2 :(得分: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