Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个 cron 作业,每小时将目录“~/foo”中的文件推送到远程服务器。
此 cron 作业运行的脚本位于“~/bar/backupScript.sh”。因此,我不能直接运行这样的 git 命令,git commit -m 'backup'因为“~/bar”不是 git 存储库。
git commit -m 'backup'
如何从“~/bar/backupScript.sh”运行与“~/foo”中的文件相关的 git 命令?
cd ~/foo在脚本的开头。
cd ~/foo