簡體   English   中英

Windows 定時任務到 git 推送到 github

[英]Windows scheduled task to git push to github

希望每晚給git加一個Windows定時任務推送到github。 我有一個 CMD 文件。 當我在 windows 命令提示符下運行 CMD 文件時,它工作正常。 但是當我通過 windows 計划任務運行它時。 它永遠卡住了。 狀態為“正在運行”。 從日志中我可以看到它成功啟動了git bash shell。 任何想法?

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

這是日志 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.

然后我做了一個實驗,將 gitpush 腳本重命名為錯誤的文件名。 它立即退出並出現錯誤“沒有這樣的文件或目錄”,這是預期的。 它顯示 gitpush 腳本正確地傳遞給 bash 但由於某種原因它被卡住了。

The reason I have to go through git bash shell is because I don't know how to setup public key in windows command line shell without using git bash shell.

謝謝!

我不知道如何在 windows 命令行 shell 中設置公鑰

公鑰/私鑰也可以在 DOS shell 中使用,前提是您定義了%HOME%環境變量(引用.ssh的父目錄)

Windows 計划任務的訣竅是確保:

  • 在實際運行任務(“系統帳戶”?還是實際用戶?)
    顯示“ env ”可以幫助調試問題。
  • 在哪里運行:如果 git 推送依賴於正確推送當前存儲庫的當前路徑,您需要確定您的任務在它應該運行的地方運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM