gitリポジトリの作成

私流リポジトリ作成時にすることメモ。サーバ、クライアント双方にgitがインストールしてあって、SSHでアクセスできることが前提。

サーバ側の設定

サーバにリポジトリを作る。

$ cd ~/repos/reponame.git
$ git init
$ git config core.bare true

クライアント側の設定

クライアントから使えるようにする。手元に一通りのソース類があって、リモートリポジトリに送るための操作。

$ cd /home/myself/workspace/project/
$ git init
$ vi .gitignore <無視するファイルを列記>
$ git add ***** <必要なファイルを追加>
$ git commit -m "first commit"
$ git remote add origin ssh://user@host:port/home/myself/repos/reponame.git
$ git push origin master

既にリポジトリがある場合のクライアント側の設定

$ cd /home/myself/workspace
$ git clone ssh://user@host:port/home/myself/repos/reponame.git project