简体   繁体   English

找不到mac homebrew git命令

[英]mac homebrew git command not found

When I run the following on a mac from the command line it works fine: 当我从命令行在Mac上运行以下命令时,它工作正常:

git submodule foreach "git checkout develop; git pull"

... but when I run it from within a .sh script it gives a git: command not found error: ...但是当我从.sh脚本中运行它时,它给出了git:命令未找到错误:

/usr/local/Cellar/git/2.14.2/libexec/git-core/git-submodule: line 355: “git: command not found

The full script is as follows. 完整脚本如下。 The checkout and pull work, but submodule foreach throws the error: 检出提取工作,但是foreach子模块抛出错误:

#!/bin/bash
set -e
set -u
git checkout develop && git pull
git submodule foreach “git checkout develop; git pull”
exit 0

Advice I've found says to make sure usr/bin is in my path. 我发现的建议是要确保usr / bin在我的路径中。 But here's what I see when I do echo $PATH (seems to already be there): 但是,这是我回显$ PATH时看到的(似乎已经存在):

/Users/myusername/.nvm/versions/node/v8.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/VMware Fusion.app/Contents/Public

Your quotes are off. 您的报价已关闭。

It should be "git checkout develop; git pull" instead of “git checkout develop; git pull” 应该是"git checkout develop; git pull"而不是“git checkout develop; git pull” “git checkout develop; git pull” . “git checkout develop; git pull”

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

相关问题 “-bash:[git:找不到命令”在mac上的bash脚本中 - "-bash: [git: command not found " in bash script on mac (Mac) -bash: __git_ps1: 命令未找到 - (Mac) -bash: __git_ps1: command not found mac osx,git mergetool,diffmerge,找不到命令 - mac osx, git mergetool, diffmerge, command not found 协助Mac Homebrew'hg'命令 - Assistance with Mac homebrew 'hg' command Mac 上的 Git 设置(错误:“-bash: git: command not found”) - Git setup on mac (ERROR: "-bash: git: command not found") 如何在Mac上修复“节点:找不到命令”? 使用自制软件中的nvm安装了节点 - How to fix “node: command not found” on a Mac? Node was installed using nvm from homebrew 在Mac OS中更新git的自制错误 - Homebrew error updating git in mac os 尽管.profile文件已更新,但在Mac上出现“找不到git命令”错误 - Get a “git command not found” error on mac though .profile file is updated Jenkins 多分支管道:在 Mac 节点上找不到 git-lfs 命令 - Jenkins Multibranch Pipeline: git-lfs command not found on Mac node 尝试使用终端组合多个.csv 文件,找不到命令:复制。 Homebrew Mac Catalina 10.15 的错误路径 - Trying combine multiple .csv files using terminal, command not found: copy. Wrong path for Homebrew Mac Catalina 10.15
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM