0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

repo init 、repo syncを使ってみる

Posted at

やりたいこと

  • repo init 、repo syncを使用して、Git Hubに載せている複数のリポジトリを一括取得したい。(今回は2つのリポジトリを取得)

準備

とりあえずリポジトリを3つ作ってみる。

取得するリポジトリ①

  • test_repo_1
    スクリーンショット 2024-06-10 021707.png

取得するリポジトリ②

  • test_repo_2
    スクリーンショット 2024-06-10 021946.png

リポジトリ③(マニフェストファイルを格納)

manifestというリポジトリを作成し、マニフェストファイル(manifest.xml)を格納。

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote fetch="https://github.com/" name="github"/>
  <project path="test_repo/test_repo_1" name="my_account/test_repo_1"  remote="github" revision="main"/>
  <project path="test_repo/test_repo_2" name="my_account/test_repo_2"  remote="github" revision="main"/>
</manifest>

"remote"でgithubを指定、
"project"で取得するリポジトリを指定しています。

リポジトリ取得

repo init / sync のオプションは公式ドキュメントを参考にしました。

repo init

repo init -b main -u https://github.com/my_account/manifest.git -m manifest.xml

repoの初期化コマンド。実行した階層に.repoディレクトリを作成する。

repo sync

repo sync -c -q

.repoが作成されたディレクトリで実行する。
manifest.xml内で指定したリポジトリを一括取得する。

実行結果

----------------------------------------------------
$ ls -la
total 16
drwxr-xr-x 4 user user 4096 Jun 10 02:02 .
drwxr-xr-x 6 user user 4096 Jun 10 01:59 ..
drwxr-xr-x 7 user user 4096 Jun 10 02:01 .repo
drwxr-xr-x 4 user user 4096 Jun 10 02:02 test_repo
----------------------------------------------------
$ tree
.
└── test_repo
    ├── test_repo_1
    │   ├── bar.txt
    │   └── foo.txt
    └── test_repo_2
        ├── hoge.txt
        └── test.txt

3 directories, 4 files
----------------------------------------------------

"test_repo"ディレクトリが作成され、"test_repo_1","test_repo_2"リポジトリが一括で取得できた。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?