bash __git_ps1 命令未找到

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19206204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 08:11:11  来源:igfitidea点击:

bash __git_ps1 command not found

macosgitbashps1

提问by alchuang

I am a beginner trying to setup a developer environment on my new Mac following the steps from this link: http://vanderveer.be/setting-up-my-perfect-developer-environment-on-osx-10-8-mountain-lion-10-8-2-final-edition/.

我是一名初学者,尝试按照以下链接中的步骤在我的新 Mac 上设置开发人员环境:http: //vanderveer.be/setting-up-my-perfect-developer-environment-on-osx-10-8-mountain -lion-10-8-2-final-edition/

After executing the files from git, my terminal window now shows:

从 git 执行文件后,我的终端窗口现在显示:

rbenv: version `1.9.3-p194' not installed
-bash: __git_ps1: command not found

The first line only shows when I open a new terminal window, while the second shows everytime I press return no matter what I type into the terminal.

第一行只在我打开一个新的终端窗口时显示,而第二行在每次我按回车键时都会显示,无论我在终端中输入什么。

I have read through many questions on stackoverflow and tried to mimic their solutions to no avail. I think I've made a mistake in installing the package from git as I am not so experienced and I think now I may have messed up the configurations, and was also wondering if there is any way to go back to default settings for bash?

我已经阅读了很多关于 stackoverflow 的问题,并试图模仿他们的解决方案无济于事。我想我在从 git 安装包时犯了一个错误,因为我没有那么有经验,我想现在我可能把配置搞砸了,而且还想知道是否有办法回到 bash 的默认设置?

Many thanks! Allen

非常感谢!艾伦

回答by John Szakmeister

If you've not installed a newer version of Git on your Mac, start by doing that. You can grab the download from here: http://git-scm.com/download

如果您尚未在 Mac 上安装较新版本的 Git,请先安装。你可以从这里下载:http: //git-scm.com/download

Once it's installed, you should source git-completion.shand git-prompt.shfrom your ~/.profile(or ~/.bashrc, if you have it):

安装完成后,你应该采购git-completion.shgit-prompt.sh从您的~/.profile(或〜/ .bashrc中,如果你有的话):

source /usr/local/git/contrib/completion/git-completion.bash
source /usr/local/git/contrib/completion/git-prompt.sh

That should fix the __git_ps1error.

那应该修复__git_ps1错误。

I'm not a Rubyist, but the rbenv error is coming from the fact that the setup in the dotfiles you are following is trying to set the default Ruby version to "1.9.3-p194". The rbenv tool is there to make a number of different Ruby versions available, but you have to install them first. In your case, I think you need to run this:

我不是 Rubyist,但 rbenv 错误来自以下事实:您所关注的 dotfiles 中的设置试图将默认 Ruby 版本设置为“1.9.3-p194”。rbenv 工具可以使许多不同的 Ruby 版本可用,但您必须先安装它们。在你的情况下,我认为你需要运行这个:

rbenv install 1.9.3-p194

After that, the version will be available, and you shouldn't see the warning anymore.

之后,该版本将可用,您不应再看到警告。