上記リンクにすべて載ってますが、こちらはそのダイジェスト版。
# プロジェクトIDを選択(セット)
$ gcloud config set project PROJECT_ID
# 選択されたか確認
$ gcloud config get-value project
$ gcloud services enable sourcerepo.googleapis.com
ミラーリング対象のリポジトリを用意します。
既存のリポジトリがあるなら、そのプロジェクトページを開いておきます。
新規で作る場合も同様に、作成後のページを開いておきます。
以下、コマンドで CSR に Git リポジトリを作成します。
$ gcloud source repos create REPO_NAME
GitLab のリポジトリミラーリング設定をする時に利用する「静的認証情報(リポジトリURL
+ パスワード
)」を CSR のコンソール上で生成します。
![]() |
---|
~/.gitcookies
に保存される)~/.gitcookies
に書き込まれた内容から リポジトリURL
と パスワード
を抽出する(以下スクリプトを保存して実行)
#!/bin/bash
if [ $# -ne 1 ] ;then
echo "リポジトリ名を指定してください。" 1>&2
exit 1
fi
# 【パスワードの抽出】
echo "password: "
grep 'source.developers.google.com' ~/.gitcookies | tail -1 | cut -d= -f2
CSR_USER=$(grep 'source.developers.google.com' ~/.gitcookies | \
tail -1 | cut -d$'\t' -f7 | cut -d= -f1)
CSR_REPO=$(gcloud source repos describe $1 --format="value(url)")
# 【リポジトリURLの抽出】
echo "repo url: "
echo $CSR_REPO | sed "s/:\/\//:\/\/${CSR_USER}@/"
# 実行例
$ ./gcloud_configure_git.sh REPO_NAME
password:
1//0gI_x-iHtpfdsF....
repo url:
https://git-REPO_USER@source.developers.google.com/p/PROJECT_ID/r/REPO_NAME
ハイライトされた部分が上記スクリプトから抽出した値です。
設定は以上です。
GitLab に Git Push して CSR に反映されるかを試します。
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing