nak
nak

Reputation: 936

Not able to run the Git custom commands from Git bash in windows

I have created a small executable file (git-test) and placed it under C:\Program Files\Git\usr\bin path.

I have also added the above path in the Path environment variable. When I run git test on bash it gives me below error.

git: 'test' is not a git command. See 'git --help'

Is there anything I am missing here or anywhere I need to paste the file.

Upvotes: 1

Views: 1813

Answers (3)

nak
nak

Reputation: 936

My bad!!! While creating the file I forgot to mention the #!/bin/sh as first line. When I added this line in my git-test file I was able to run the file from git bash using the command git test.

Upvotes: 6

CodeWizard
CodeWizard

Reputation: 142662

Git does not have a test command.

If you want to set your own git command you should set git alias.
Gti aliases can be simple commands. multiple commands and even executing a script file.

For example you can see here few simple aliases + some complex ones.
Take a look on the l alias. Its alias for a bash script in unix.

In your case create an alias for your test script in the same way.

enter image description here

Upvotes: 0

Skrat
Skrat

Reputation: 587

git test is not a command that git knows, as it's telling you by hinting at the available commands listed by running git --help.

To execute that command, type: git-test because that's the full command name.

Upvotes: -2

Related Questions