如何从 AppleScript CD 到我的本地 git 仓库?

How to cd into my local git repo from an AppleScript?

我正在 运行宁 Mac 使用 OSX Yosemite v10.10.5.

我想使用 AppleScript 将本地 git 存储库推送到远程。

所以 git 代码将是:

shell
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/myusername/my-project.git
git push -u origin master

但是为了从终端运行这个,首先我需要cd进入我的本地目录。

cd my-directory

那么我如何从 AppleScript 中完成所有这些操作?或者脚本编辑器中的 JavaScript 选项也有帮助。

使用 "git -C dir command" 表格明确告诉 git 在哪里工作。

评论摘要(根据@PaulR):

Put everything in a bash script and then just run that bash script from AppleScript.

myAppleScript.applescript
do shell script "my_script.sh"