windowsにghqを入れてGitHubのローカルリポジトリを管理する
Scopeを入れる(ghqを入れるのに使う)
lukesampson/scoop: A command-line installer for Windows.
PowerShellを起動しコマンド実行
PS> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force PS:> iwr -useb get.scoop.sh | iex
ghqをインストールする
PS> scoop install ghq Installing 'ghq' (1.1.5) [64bit] ghq_windows_amd64.zip (3.0 MB) [==============================================================================] 100% Checking hash of ghq_windows_amd64.zip ... ok. Extracting ghq_windows_amd64.zip ... done. Linking ~\scoop\apps\ghq\current => ~\scoop\apps\ghq\1.1.5 Creating shim for 'ghq'. 'ghq' (1.1.5) was installed successfully!
ghqバージョン確認
PS> ghq --version ghq version 1.1.5 (rev:f5ac3e5)
各リポジトリが置かれる場所を設定する
- 以下、Git Bash で作業実施した
$ git config --global ghq.root ~user1/ghq
- 設定されたことを確認
$ git config --global ghq.root C:/Users/user1/ghq
ghqルートディレクトリの下にリモートリポジトリのクローンを作成する
$ ghq get https://github.com/x-motemen/ghq.git clone https://github.com/x-motemen/ghq.git -> C:\Users\user1\ghq\github.com\x-motemen\ghq git clone --recursive https://github.com/x-motemen/ghq.git C:\Users\user1\ghq\github.com\x-motemen\ghq Cloning into 'C:\Users\user1\ghq\github.com\x-motemen\ghq'... remote: Enumerating objects: 33, done. remote: Counting objects: 100% (33/33), done. remote: Compressing objects: 100% (25/25), done. remote: Total 2917 (delta 12), reused 20 (delta 8), pack-reused 2884 Receiving objects: 100% (2917/2917), 684.83 KiB | 947.00 KiB/s, done. Resolving deltas: 100% (1793/1793), done.
- 試しにもう一つ別のリモートリポジトリのクローンを作成する
$ ghq get https://github.com/taniarascia/takenote.git clone https://github.com/taniarascia/takenote.git -> C:\Users\user1\ghq\github.com\taniarascia\takenote git clone --recursive https://github.com/taniarascia/takenote.git C:\Users\user1\ghq\github.com\taniarascia\takenote Cloning into 'C:\Users\user1\ghq\github.com\taniarascia\takenote'... remote: Enumerating objects: 114, done. remote: Counting objects: 100% (114/114), done. remote: Compressing objects: 100% (92/92), done. Rremote: Total 4672 (delta 44), reused 50 (delta 20), pack-reused 4558 Receiving objects: 100% (4672/4672), 10.13 MiB | 4.64 MiB/s, done. Resolving deltas: 100% (2989/2989), done.
ローカルに複製されたリポジトリを一覧表示する
$ ghq list github.com/taniarascia/takenote github.com/x-motemen/ghq
以上。