我正在使用python脚本拉入和推入github存储库。对于github存储库,我需要使用ssh密钥
如果在运行脚本之前手动执行此操作:
eval $(ssh-agent -s)
ssh-add ~/.ssh/myprivkey
一切正常,剧本也正常。但是,过了一段时间,密钥显然过期了,我必须再次运行这两个CMD
问题是,如果我在python脚本中使用os.system(cmd)
执行此操作,它将不起作用,只有在手动执行此操作时才起作用
我知道使用ssh代理肯定是一种混乱的方式,但我真的不知道它是如何工作的,我只想让脚本工作,仅此而已
脚本每小时运行一次,以防万一
正常的方法是在Ssh代理已经运行的shell中运行Python脚本,也可以考虑使用{A1}
的另一种方法。相关问题 更多 >
编程相关推荐