Linux 尝试运行扩展GIT的脚本
我已将以下内容保存为.sh文件,并从根目录执行: 有几个错误:Linux 尝试运行扩展GIT的脚本,linux,git,bash,shell,Linux,Git,Bash,Shell,我已将以下内容保存为.sh文件,并从根目录执行: 有几个错误: script.sh: line 65: conditional binary operator expected script.sh: line 65: syntax error near `=~' script.sh: line 65: `while [[ $1 =~ ^\- ]]; do' 然后,当我运行git rewrite history命令时,我收到一个错误: 'git-rewrite-history' is not r
script.sh: line 65: conditional binary operator expected
script.sh: line 65: syntax error near `=~'
script.sh: line 65: `while [[ $1 =~ ^\- ]]; do'
然后,当我运行git rewrite history命令时,我收到一个错误:
'git-rewrite-history' is not recognized as an internal or external command,
operable program or batch file.
非常感谢您的帮助,这里有0 linux经验
谢谢
编辑-我正在使用windows中的bash,这可能与此问题有关。
将尝试在Linux发行版上运行
您需要设置脚本执行权限:
chmod 777 path/to/git-rewrite-history
名为
git rewrite history
(即使在Windows上)的bash脚本必须在以下条件下执行:
git rewrite-history
只要git xxx
位于%PATH%
环境变量引用的文件夹中,任何名为git xxx
的脚本都可以通过这种方式调用(git xxx
)
bash脚本将在git会话中执行,即使从简单的Windows CMD shell会话调用也是如此。你根本不需要Cygwin。谢谢你的评论,尽管它对我不起作用。请查看我的操作编辑。
git rewrite-history