githubにファイルをアップする方法(その1)

先日githubの会員登録をした。ものの、使いかたがちょっとわかりにくかったというか、忘れそうだったのでメモ。

1. 会員登録

https://github.com/

上記のgithubの公式サイトから無料のユーザー登録をする。

2. 新しいリポジトリを作成する

ログイン後、画面右下に小さく「New Repository」というボタンがあるので、
そこをクリックする。

すると、リポジトリ新規作成画面に遷移するので、必要情報を入力する。

Project Name ・・・ プロジェクト名を入力します。(必須項目)
Description・・・概要を入力します。(オプション)
Homepage URL・・・ホームページURLを入力します。(オプション)

Who has access to this repository? (You can change this later)
↑無料版では「Anyone」しか選択できないのでそのまま「Create Repository」をクリックします。

うまくいくと、下のような画面に移動します。

続いて、githubの初期設定をします。

3. githubの初期設定をする

Global setup:

Set up git
git config –global user.name “Your Name”
git config –global user.email ryo.tsugawa@gmail.com

Next steps:

mkdir Backup-DB
cd Backup-DB
git init
touch README
git add README
git commit -m ‘first commit’
git remote add origin git@github.com:ryotsun/Backup-DB.git
git push -u origin master

Existing Git Repo?

cd existing_git_repo
git remote add origin git@github.com:ryotsun/Backup-DB.git
git push -u origin master

Importing a Subversion Repo?

Click here

When you’re done:

Continue

順番としては、これらの設定を行う前に、gitというパッケージをインストールしておく必要があります。

公式サイトにはGUIツールやらyumで簡単にインストールできるものが紹介されていますが、今回はtar.gz形式のソースファイルからgitをインストールすることにします。

(というか、CentOSのyumにはgitがまだない^^;;)

http://kernel.org/pub/software/scm/git/ にてgitが配布されているので、最新版をwgetで取得しちゃう。2011/8/29現在、最新版は1.7.4.5

[root@localhost ~]# wget http://kernel.org/pub/software/scm/git/git-1.7.4.5.tar.gz

あとは普通に展開してインストールしちゃう。

[root@localhost ~]# tar zxvf git-1.7.4.5.tar.gz

[root@localhost ~]# cd git-1.7.4.5

[root@localhost ~]# ./configure –prefix=/usr/local/git-1.7.4.5
//インストール先を/usr/local/git-1.7.4.5に指定した

 

[root@localhost ~]# make

[root@localhost ~]# make install

 

次に、「git」のパスを通す

[root@localhost ~]# ln -s /usr/local/git-1.7.4.5/bin/git /usr/local/bin/git

これでようやくgithubの設定を行う準備ができた。
長くなったので、その2に続く・・・。

githubにファイルをアップする方法(その2)

 

コメントを残す

メールアドレスが公開されることはありません。

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>