Answer the question
In order to leave comments, you need to log in
How to open a file from the command line?
in .bat
"%ProgramFiles%\Git\git-bash.exe" "F:\OSPanel\domains\logreel.com\upload.sh" "*"
git add compile release resource
git commit -m "$1"
git push
Answer the question
In order to leave comments, you need to log in
Obviously an error on the command:
Judging by the text - git cannot find compile.
It looks like you still need to do cd, because. you're running an extra shell, git-bash, and it has a default directory, most likely the user's home directory, not the one you're running it from.
It's easy to check - run git-bash manually from the command line without parameters and see what directory the pwd command will give.
So git status shows that the compile and release folders are a level higher. You need to either run the script from the root directory, or specify the paths not relative to the root, but relative to the launch folder. And it is better to go to a certain directory inside the script and use the paths relative to it.
The third option, in my opinion, is the most adequate, since otherwise it is easy to accidentally run the script from the wrong place and get the wrong result.
You can get the path to the directory in which the script is physically located, for example, like this:
scriptPath="$(readlink -f ${BASH_SOURCE[0]})"
scriptDirPath="$(dirname $scriptPath)"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question