Windows scheduled task on git clicking on github

I hope to add a scheduled Windows task to git push to github every night. I have a CMD file. When I run the cmd file on the windows command line, it works fine. But when I run it through a scheduled Windows task. He is stuck forever. The status is "running." And from the log, I see that he successfully started the git bash shell. Any idea?

echo git push > i:\gitpush echo 'pushing' >>log1 C:\WINDOWS\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login i:\gitpush" >>log1 2>>error echo 'done pushing' >>log1 del i:\gitpush 

Here is the log output:

 'pushing' Welcome to Git (version 1.7.4-preview20110204) Run 'git help git' to display the help index. Run 'git help <command>' to display help for specific commands. 

Then I did an experiment to rename the gitpush script to the wrong file name. And he immediately came up with the error "There is no such file or directory," which is expected. It shows that the gitpush script goes to bash correctly, but for some reason it is stuck.

I have to go through the git bash shell because I donโ€™t know how to configure the public key on the Windows command line command line without using the git bash shell.

Thanks!

+6
source share
1 answer

I donโ€™t know how to configure the public key on the Windows command prompt

Public / private keys also work in the DOS shell if you define the %HOME% environment variable (referring to the parent .ssh )

The trick with a scheduled Windows task is to:

  • who actually runs the task ("system account" or the actual user?)
    Displaying " env " may help debug the problem.
  • where it is running: if git push depends on the current path, in order to correctly click on the current repo, you need to be sure that your task is executed where it should.
+2
source

Source: https://habr.com/ru/post/893219/


All Articles