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.
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
.
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.