【发布时间】:2016-08-08 06:53:51
【问题描述】:
我正在使用 OSX Yosemite v10.10.5 运行 Mac。
我想使用 AppleScript 将本地 git 存储库推送到远程。
所以 git 代码是:
贝壳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 选项也会有所帮助。
【问题讨论】:
-
将所有内容放入 bash 脚本中,然后从 AppleScript 运行该 bash 脚本?
-
@PaulR:这是个好主意!如果您能提示如何从 AppleScript 运行 bash 脚本,我会很乐意支持并接受您的回答。在这一点上,我只知道如何从 AppleScript 运行单个 shell 命令。
-
你可以使用
do shell script "my_script.sh"。我会写一个答案,但我现在在移动设备上 - 如果你愿意,请随时将其转换为答案,
标签: git macos shell github applescript