弄了一个SAE云应用跑定时脚本,但是脑抽选了使用git方式管理项目。选完才发现自己完全不会,搞了一下午,才把代码发布上去。
下面几条关键命令,自己mark一下。
(1)创建一个新的Git仓库并且添加一个Git远程仓库sae,地址为:https://git.sinacloud.com/newapp 。
$ mkdir newapp
$ cd newapp
$ git init
$ git remote add sae https://git.sinacloud.com/newapp
(2)上传代码
$ git add index.php
$ git commit -m"initial commit"
$ git push sae master:1
(3)删除版本1的代码
$ git push sae :1
最后推送代码的时候总是要输入账号密码,神烦,可以用 credential helper 来避免每次提交都要输入密码。
$ git config --global credential.helper cache
# Set git to use the credential memory cache
$ git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)
(3)克隆代码
git clone -o sae https://git.sinaapp.com/gitsrc