登录
首页 >  Golang >  Go问答

"解决在bash shell中找不到.git存储库的错误"

来源:stackoverflow

时间:2024-03-01 22:15:25 299浏览 收藏

Golang不知道大家是否熟悉?今天我将给大家介绍《"解决在bash shell中找不到.git存储库的错误"》,这篇文章主要会讲到等等知识点,如果你在看完本篇文章后,有更好的建议或者发现哪里有问题,希望大家都能积极评论指出,谢谢!希望我们能一起加油进步!

问题内容

我想在 wsl2 上为 .bash 安装 powershell10k。我运行命令时没有安装 go

go get -u github.com/justjanne/powerline-go

并且错误是致命的:不是 git 存储库。

现在的问题是,每次我启动 shell 时,我都会收到 4 行

fatal: not a git repository (or any of the parent directories): .git

就好像我再次提出了错误的请求,但我没有。如果我在输入 cd /pro + tab 后尝试自动完成,我每次都会得到此输出,无论我尝试自动完成哪个目录:

cd profatal: not a git repository (or any of the parent directories): .git
cd profatal: not a git repository (or any of the parent directories): .git
jects/

“profatal”行是“projects”的开始,但是当使用选项卡自动完成时,会输入该错误。

如果能深入了解为什么会发生这种情况/我如何查看 git 请求的来源,我们将不胜感激。


解决方案


注释掉 .bashrc 中的以下行以修复因我输入的无效命令而引起的自动完成问题。添加 go 后可能会添加配置文件,这改变了我的提示符和 shell 的配置方式:

感谢@jimb 的帮助。

# if ! shopt -oq posix; then
#   if [ -f /usr/share/bash-completion/bash_completion ]; then
#     . /usr/share/bash-completion/bash_completion
#   elif [ -f /etc/bash_completion ]; then
#     . /etc/bash_completion
#   fi
# fi

到这里,我们也就讲完了《"解决在bash shell中找不到.git存储库的错误"》的内容了。个人认为,基础知识的学习和巩固,是为了更好的将其运用到项目中,欢迎关注golang学习网公众号,带你了解更多关于的知识点!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>