0

I have a python script called git_update.py to git pull a repository and I want to schedule this to run everyday at 6 AM. but the below code doesnnot work

git_update.py

import os
import schedule
import logging
import subprocess

def git_update():
    out = subprocess.check_output(["git", "pull"])

if __name__ == '__main__':
    schedule.every().day.at("06:00").do(git_update)

And I reason I think it doesn't work because it always asks for my password whenever I pull a repository. Is there any way I can have the password saved when I first launch the script using nohup git_update.py &

4
  • 1
    This is not really related to Python; the same thing would happen with basic shell script. The cron daemon has no access to your ssh secrets, if indeed the SSH agent is even running when the job starts. Commented Nov 18, 2020 at 17:59
  • @tripleee Can do point me to the link to the shell script that does the same? Commented Nov 18, 2020 at 18:03
  • 1
    The "script" to do this in shell is just git pull. Regarding management of secrets, see stackoverflow.com/questions/2205282/… but I'm obviously guessing what you are actually hoping to accomplish here. Commented Nov 18, 2020 at 18:05
  • stackoverflow.com/search?q=%5Bgit%5D+save+password Commented Nov 18, 2020 at 18:16

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.