Yoni Mor
Yoni Mor

Reputation: 354

Trying to run a script that extends GIT

I've saved the following as an .sh file and executed it from my root directory: https://gist.github.com/emiller/6769886

Got a couple of errors:

script.sh: line 65: conditional binary operator expected
script.sh: line 65: syntax error near `=~'
script.sh: line 65: `while [[ $1 =~ ^\- ]]; do'

And then when I ran the git-rewrite-history command I received an error:

'git-rewrite-history' is not recognized as an internal or external command,
operable program or batch file.

Would appreciate help, 0 linux experience here.

Thanks.

Edit - I'm using bash from windows, which is probably related to the issue. Will attempt on a Linux distribution.

Upvotes: 1

Views: 67

Answers (2)

VonC
VonC

Reputation: 1323223

A bash script named git-rewrite-history (even on Windows) must be executed with:

git rewrite-history

Any script named git-xxx can be called that way (git xxx), as long as git-xxx is in a folder referenced by your %PATH% environment variable.
The bash script will be executed in the msys2 bash git session, even when called from a simple Windows CMD shell session.
You do not need Cygwin at all.

Upvotes: 0

CodeWizard
CodeWizard

Reputation: 141946

'git-rewrite-history' is not recognized as an internal or external command,
 operable program or batch file.

You need to set the script execution permissions:

chmod 777 path/to/git-rewrite-history

Upvotes: 1

Related Questions