_J Blog

学んだ事のまとめやメモなどが中心です

git clone 時に origin の名前を指定して clone する

最近使ったので、メモ。ヘルプにも書いてるけど。

$ git clone git@example.com:hogehoge.git -o hoge

そうすれば、originの名前を指定しつつcloneできます
gitconfigはこんな感じ
$ cat hogehoge/.git/config

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "hoge"]
	fetch = +refs/heads/*:refs/remotes/xxxx/*
	url = git@example.com:hogehoge.git

Helpには

--origin        -o  -- use given remote name instead of "origin" 

とある