Closed6

ghq で新しいリポジトリを作成する

ピン留めされたアイテム
noid11noid11

結論

ghq を使っている環境でローカルリポジトリを作成したい場合、 ghq create コマンドを使えば良い

% ghq create --help
NAME:
    create - Create a new repository

USAGE:
    ghq create <project>|<user>/<project>|<host>/<user>/<project>

OPTIONS:
    --vcs vcs   Specify vcs backend explicitly
    --help, -h  show help (default: false)
% ghq --version
ghq version 1.2.1 (rev:dd139fb)

https://github.com/x-motemen/ghq#synopsis
https://github.com/Songmu/ghq-handbook/blob/master/ja/06-ghq-create.md

noid11noid11

ハンドブックにも記載がある
https://github.com/Songmu/ghq-handbook/blob/master/ja/06-ghq-create.md

ghqのルールに則って、ローカルリポジトリの作成もできます。ディレクトリの作成とリポジトリの初期化までおこないます。

% ghq create <target>

targetの指定ルールはghq getとほぼ同様ですが、ghq create {{Project}}とした場合のowner補完では、ghq.completeUser設定に関わらず、自分自身が補完されます。

noid11noid11

自分の環境でも ghq create を試して、ローカルリポジトリが作成できることを確認した

% ghq create https://github.com/noid11/hello-ghq
       git init
Initialized empty Git repository in /Users/username/ghq/github.com/noid11/hello-ghq/.git/
/Users/myusername/ghq/github.com/noid11/hello-ghq
% ghq --version
ghq version 1.2.1 (rev:dd139fb)
% sw_vers
ProductName:	macOS
ProductVersion:	11.4
BuildVersion:	20F71
このスクラップは2021/07/16にクローズされました