使用apple脚本更新git存储库

时间:2016-04-27 13:32:22

标签: git applescript

我想用Apple脚本更新我的git Bitbucket在线存储空间。这是在终端中运行的代码,但不是在我运行apple脚本时。

cd /Users/mainuser/Desktop/Projects git add -A
git commit -m fromAppleScript
git push

精心制作成苹果脚本:

        say "updating backup"
        do shell script "cd /Users/mainuser/Desktop/Projects git add -A"
        do shell script "cd /Users/mainuser/Desktop/Projects git commit -m fromAppleScript"
        do shell script "cd /Users/mainuser/Desktop/Projects git push"

我有点疑惑为什么这段代码不起作用。你能解决这个问题吗?

2 个答案:

答案 0 :(得分:1)

我相信您遇到的问题是在cdgit add命令之前使用git commit命令。您将两个命令链接在一起。

答案 1 :(得分:1)

do shell script "cd /Users/mainuser/Desktop/Projects && git add -A && git commit -m fromAppleScript && git push"