0

Before git for windows was upgraded to version 2.x.x I was running scripts by simply creating a file with name pull and inside it I was putting something like git pull origin master. It was running normally, after I made format and install latest version of git it don't support that scripts any more. The error I have is: bash: pull: command not found. I have tried to add .bat and .sh to those files, and that didn't work out.

update:

Now i have in the file pull content:

#!/bin/bash
git pull origin master

To run that script i need to execute on terminal ./pull. Can i somehow use that script without ./?

2 Answers 2

1

What does work in Windows is creating a script called git-xxx (no extension).
For instance: git-mypull.

In that script, you can write a regular bash script, starting with #!/bin/bash.
It will be execute in the mingw-64 shell session which comes with the latest Git for Windows 2.5.x.

You call that script with git xxx (note the space): git mypull.


Now I have in the file pull content:

#!/bin/bash
git pull origin master

To run that script I need to execute on terminal ./pull.
Can I somehow use that script without ./?

Yes, as long as pull is in one of the folders referenced by echo %PATH%.
Then a simple pull would work.

Sign up to request clarification or add additional context in comments.

4 Comments

Sorry for delay, it didn't work for me, and generally i didnt like to use git-
@GoncharDenys if git-mypull is referenced by your %PATH%, it will work, I promise. I use that all the time, from a regular DOS session.
@GoncharDenys I have edited my answer to address your update
Ok, your answer work too. I have did what i needed in my answer, so you can check if you want.
1

That did the trick: printf '#!/bin/bash\ngit pull origin master' > ~/bin/pull . I pasted generator code, just in case. it could be just file in the folder ~/bin in your user folder. Before you run that script, you should create folder bin. Also you can modify scripts to file you need. On the script i have pasted, when you write in terminal pull it start git pull origin master

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.