我正在尝试制作一个 python 脚本来检查我的 git 本地工作文件夹中的更改,并自动将它们推送到在线仓库。目前只能手动使用 git 来完成。我想知道,在没有人工干预的情况下,脚本需要什么才能做到这一点。
我在 shell 中输入的命令是:
#for checking the status, and determining if there are untracked files
git status
#if there are untracked files...add them
git add .
#add my commit message
git commit -m "7/8/2012 3:25am"
#push it to my online repo
git push origin master
#check if changes came on remote
git diff origin/master
#merge my repo with origin
git merge origin/master
执行 git push 时,您总是需要输入用户名/密码。我知道 git 有办法解决这个问题,包括制作 ssh 密钥等等。但我假设 GitPython 有某种方式可以做到这一点。我的意思是我们可以通过代码传递用户名/密码,或者使用前者。那么当我使用 GitPython 时,我有哪些关于身份验证的选项?
编辑:有些应用程序实际上会生成 ssh 密钥,例如 github 的 windows 应用程序。windows应用程序是如何做到这一点的?我的假设是肯定有一些 git api 用于它......