Run batch file with git pull in gitbash

I have the following problem. I want to write a batch file and run this file every day on vm.

I have an ssh key to the vm, so if I manually write "git pull" in gitbash, I won't write the password after that.

Now I want to write a script in a batch file that will do this automatically.

c://TESTS/test/tes

- I only want to pull one folder from the repo.

I don't know how to create a script like this. Any ideas?

+3


source to share


2 answers


I found a solution in the basic cmd:

cd c://TESTS/path
set HOME=%USERPROFILE%
git pull 
pause

      



I missed the HOME variable. It now works without using git.exe or bash.exe.

+6


source


Since git is not in your PATH, you need to add it to your script package.



@echo off
set PATH=%PATH%;C:\path\to\git
cd c://TESTS/test/tes
git pull

      

+2


source







All Articles