4月 2009 からの投稿
gitのconfig設定
$ git config --global user.name "my name"
$ git config --global user.email myemailaddress@example.com
$ git config --global color.diff auto
$ git config --global color.status auto
$ git config --global color.branch auto
$ git config --global color.interactive auto
$ git config --global --list
user.name=my name
user.email=myemailaddress@example.com
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=auto
カテゴリー: Programming
タグ: git
Sinatra
Sinatra source code
gemでインストール
$ sudo gem install sinatra
Password:
Successfully installed rack-0.9.1
Successfully installed sinatra-0.9.1.1
2 gems installed
Installing ri documentation for rack-0.9.1...
Installing ri documentation for sinatra-0.9.1.1...
Installing RDoc documentation for rack-0.9.1...
Installing RDoc documentation for sinatra-0.9.1.1...
$ mkdir test
$ cd test/
$ touch test.rb
test.rbを編集
$ emacs test.rb
require 'rubygems'
require 'sinatra'
get '/' do
'Hello world'
end
get '/hello/:name' do |n|
"Hello #{params[:name]}"
end
サーバを立ち上げて実行
$ ruby test.rb
== Sinatra/0.9.1.1 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.0.0 codename That's What She Said)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
http://0.0.0.0:4567/にアクセス
カテゴリー: Programming
タグ: ruby
githubにリポジトリを作成する
「create a new one」をクリック

リポジトリ情報を埋める

リポジトリが作成されるので、自分の開発環境でセッティング。

表示された通りにやれば問題ない。
以下は実際の記録。
$ mkdir dotfiles
$ cd dotfiles/
matsuda:dotfiles matsuda$ git init
Initialized empty Git repository in /Users/matsuda/dev/dotfiles/.git/
$ touch README
$ git add README
$ git commit -m 'first commit'
[master (root-commit) 933f10d] first commit
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README
$ git remote add origin git@github.com:matsuda/dotfiles.git
$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 210 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:matsuda/dotfiles.git
* [new branch] master -> master
ただし、公開鍵設定をしていないとpushで失敗する。
公開鍵の設定は
Guides: Providing your SSH Key
を参考に。
# $ ssh-keygen -t rsa
$ ssh-keygen
# ひたすらEnter
# Macコマンドでクリップボードにコピー
$ cat id_dsa.pub | pbcopy
githubの[account]→[SSH Public Keys]にコピペ
最後に「Continue」をクリックしたら、完了。

カテゴリー: Programming
タグ: git