openshiftとかいうサービス上でexpressを動かすために七転八倒。ひとまず正解をメモしておく。
"scripts": { "start": "node bin/www" }, "main": "./bin/www",
/** * Get port from environment and store in Express. */ var port = normalizePort(process.env.OPENSHIFT_NODEJS_PORT || '8080'); var ip = process.env.OPENSHIFT_NODEJS_IP; if (typeof ip === "undefined") { // Log errors on OpenShift but continue w/ 127.0.0.1 - this // allows us to run/test the app locally. console.warn('No OPENSHIFT_NODEJS_IP var, using 127.0.0.1'); ip = "127.0.0.1"; }; app.set('port', port); /** * Create HTTP server. */ var server = http.createServer(app); /** * Listen on provided port, on all network interfaces. */ server.listen(port, ip); server.on('error', onError); server.on('listening', onListening);
freebsd10.1の場合
$ sudo pkg install git $ git config --global user.name "<ユーザ名>" $ git config --global user.email "<メールアドレス>"
mkdir ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa -C "<メールアドレス>"
→全てENTER
.ssh内にid_rsaとid_rsa.pubが生成された
openshiftのコントロールパネルのメニューから「Setting」をクリック
「Public Keys」の「Add a new key...」をクリック
「Key name」→適当な名前を入力
「Paste the contents of your public key file」→~/.ssh/id_rsa.pub の内容をコピペ
[Application]→[クローンしたいアプリを選択]→[Source Code]のコードをどこかに保存。
仮に
ssh://xxxxxxxxxxxxxxxxxxxxxxxxxxxx@yyy-zzzzz.rhcloud.com/~/git/yyy.git/
だったとすると、クローンのコマンドはこんな感じ。
$ git clone ssh://xxxxxxxxxxxxxxxxxxxxxxxxxxxx@yyy-zzzzz.rhcloud.com/~/git/yyy.git/ $ cd yyy/
プッシュしたいデレクトリに入って
$ git add .;git commit -m 'My changes';git push