ハマったので覚えるために記事にしました。

###サーバ等で
shell>>
$ mkdir repo.git
$ cd repo.git
$ sudo git init --bare --shared=true
<<--

**"空"**の共有リポジトリができました。

###ローカルマシンで
その後、remote add, add, commit, push

shell>>
git init
git remote add origin ssh://git.s21g.com/mnt/git/repo.git
git add .
git commit -m "initial import"
git push origin master
<<--

サーバのrepo.gitにファイルが追加された時点でcloneできるようになります。空のリポジトリをcloneしようとしてもエラーが出ます:

shell>>
$ git clone ssh://git.s21g.com/mnt/git/repo.git
fatal: no matching remote head
<<--

###おまけ:git URLを確認する git remote show origin
shell>>
git remote show origin

  • remote origin
    URL: ssh://git.s21g.com/mnt/git/repo.git
    <<--
posted by satoko satoko on Thu 19 Feb 2009 at 14:22 with 0 comments