Cloud9 使用 GitHub

Cloud9是一款云平台在线编辑器,它可以支持javascript,php,python,ruby等多达23种的语言,通过在线编写代码,可以在任何地方访问这个代码,并且集成了多个版本控制的工具。Cloud9 上面如何使用github呢?

首先,在github网站里新建一个repository,比如起名叫Cloud9Demo;

然后,使用github账号登录Cloud9,进入里面的dashboard,新建一个workspace,新建的时候,选择"Clone from url",输入你的repository的URL即可。当你的projec需要push的时候,选择tools->git->push即可。

当然,比如你已经新建了一个workspace,并且完成了一些工作的话,你可以在cloud9的命令行里面直接使用git命令,比如:

`git remote add [remote name] [remote url (eg. 'git@github.com:/ajaxorg/node_chat')]` [Enter]
* Create new files inside your project
* Add them to to Git by executing the following command
`git add [file1, file2, file3, ...]` [Enter]
* Create a commit which can be pushed to the remote you just added
`git commit -m 'added new files'` [Enter]
* Push the commit the remote
`git push [remote name] master` [Enter]

需要注意的是,这里的git使用ssh,因此必须使用git@github.com:/username/xxx.git 而不是https,否则会出错,具体见:https://github.com/ajaxorg/cloud9/issues/1709

以后修改之后直接 git add file,然后 git commit, git push 即可。

过程其实很简单,具体可以参见:How do i commit changes to github within Cloud9 IDE?

posted @ 2012-11-20 21:18  cubika  阅读(1996)  评论(0编辑  收藏  举报