I am learning how to use git bash for Windows and I want to start writing scripts to automate some of the git tasks I do. But where should I store the .sh files so that I can call them from any directory in git bash? Is there a standard directory they should be saved in?

At the minute I have to include a path to where the .sh file is. What I want is that when I am in git bash I can call the script just like I would any git command i.e. without a path.


You can run them from anywhere that the script has permissions to. I typically put my scripts in 'c:\scripts'.


You could edit your Path environment variable to include the folder to your scripts. Start --> Right click Computer --> Properties --> Advanced System Settings --> Environment Variables.

It is a System variable on Windows 7; separate each path with a semicolon.

After that, reload the command prompt and it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.