简体   繁体   English

我如何从$ PATH删除git或更改路径,使其不再包含它(macOS)

[英]how can i delete git from $PATH or change path so that it no longer contains it (macOS)

I have recently updated git and it has changed my path to 我最近更新了git,并将它的路径更改为

/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/matthew/git I try to use composer and execute files and I get the error / usr / local / git / bin:/ usr / local / bin:/ usr / local / sbin:/ matthew / git我尝试使用composer并执行文件,但出现错误

env: php: No such file or directory. env:php:没有这样的文件或目录。 when 什么时候

I reset the path back to 我将路径重置为

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" everything works fine and composer loads but the only thing is it automatically sets the path back to /usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/matthew/git in a matter of seconds after me doing what I need to do. 导出PATH =“ / usr / local / bin:/ usr / bin:/ bin:/ usr / sbin:/ sbin”一切正常,并且加载了composer,但唯一的事情是它自动将路径设置回/ usr / local / git / bin:/ usr / local / bin:/ usr / local / sbin:/ matthew / git在完成我需要做的事情后的几秒钟内。

i thought the path would stay and go back to the original one i reset it to but it auto reverts back to the git one Is there any way i can fix this without having to reinstall the operating system? 我以为路径会保留下来,并返回到原来的路径,但我将其重置为,但它会自动恢复为git一个。有什么方法可以解决此问题,而无需重新安装操作系统? and keep the path as PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" i have been stuck on this for two days i just want rid of git 并保持路径为PATH =“ / usr / local / bin:/ usr / bin:/ bin:/ usr / sbin:/ sbin”我已经坚持了两天,我只想摆脱git

you should update your .bash_profile file 您应该更新您的.bash_profile文件

you can check this guide for futher details 您可以查看本指南以获取更多详细信息

@funkyjelly谢谢,但这还是不好,最终不得不重新安装操作系统并通过家庭Brew安装git,路径问题解决了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM