Giblabで日本語表示に修正する
- 画面の右上隅にある丸いアイコン(ユーザーのプロフィールアイコン)をクリックします。
- 表示されたメニューの中から [Preferences](環境設定) を選択します。
- [Localization](地域化 / ローカライズ) という項目を探します。
その中にある [Language] のプルダウンメニューをクリックし、「日本語」 を選択します。 - ページの一番下までスクロールし、青いボタンの [Save changes](変更を保存) をクリックします。
- ログアウトして再度ログイン。これで画面全体が日本語に切り替わります。
注意点
GitLabの日本語翻訳は、完全に100%すべての項目が翻訳されているわけではないため、一部の高度な設定やメニュー名が英語のまま残る場合がありますが、通常の操作やメンバー管理のメニューは日本語で表示されるようになります。
ユーザ作成手順
1.管理者をクリック
2.インスタンス概要→ユーザをクリック
3.新規ユーザーをクリック
アクセストークン発行手順
1.丸いユーザーアイコン→設定をクリック
2.アクセス→パーソナルアクセストークンをクリック
3.トークンを生成からトークンを生成できます。
4.生成したトークンを使って端末から作業ができます。
※作成されたAPIキー(トークン)が一度だけ表示されます。画面を閉じると二度と表示できなくなるため、必ずコピーして安全な場所に保存してください。
SSHキーの使い方
1.SSHキーをクリックする
2.SSHキーをクリックする
鍵がない場合は端末で以下のコマンドを実行する
#ssh-keygen -t ed25519 -C "your_email@example.com"
※メールアドレスは自分のものに変更してください
3.内容を張り付ける
gitコマンドでの操作
まずはgit clone
自分のディレクトリ作成
#mkdir mygit
#cd mygit
#git clone http://ユーザ名:アクセスキー@192.168.2.176/ユーザ名/プロジェクト名.git
その後
ブランチ作成
※インフラはGUIでイシューを作成してからブランチ作成が一般的
#git checkout -b staging
作成したブランチへの移動
#git branch -a # 現在のブランチを確認
#git checkout staging #
#git branch -a # 移動できたことを確認
サブモジュールとして追加する手順 まずはブランチでの作業しています
こういう構成の場合
今回は、testzzzプロジェクトのサブモジュールとしてbbbprojectを追加する場合
サブモジュールとして追加
#git submodule add ../bbbproject.git bbbproject
サブモジュール追加後git statusで確認(当然差分が出る)
git status
On branch staging
Your branch is up to date with 'origin/staging'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: .gitmodules
new file: bbbproject
追加できているのでaddする
#git add .
#git commit -m "Add bbbproject as a submodule"
#git push origin staging
mainブランチへの反映
マージリクエストを作成をクリック
タイトル等をいれたら、「マージリクエストを作成」をクリック
※マージリクエストが承認されたときにソースブランチを削除はチェックを入れるのが一般的
※変わった現場だと、残しておく。
サブモジュールだけ更新
#git submodule update --remote bbbproject
サブモジュールだけ更新したことがわかる
サブモジュール名(bbbproject)
#git status
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: bbbproject (new commits)
no changes added to commit (use "git add" and/or "git commit -a")
サブモジュールの変更を取り込む
※git statusの情報が変更されます。
#git add bbbproject
#git commit -m "Update submodule bbbproject to latest version"
#git status
On branch staging
Your branch is ahead of 'origin/staging' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
最後にpushします。
# git push origin staging
Username for 'http://192.168.2.176': kenken
Password for 'http://kenken@192.168.2.176':
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 265 bytes | 265.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for staging, visit:
remote: http://192.168.2.176/kenken/testzzz/-/merge_requests/new?merge_request%5Bsource_branch%5D=staging
remote:
To http://192.168.2.176/kenken/testzzz.git
* [new branch] staging -> staging
サブモジュールの場合
参照先番号が変わります。そこで変更をGUIから確認できます。
あとはGUIでマージリクエストを出します。
gitお作法
#最新情報取得
git fetch
#mainブランチの最新情報を取得
git checkout main
#git pull(mainブランチで)
#追いつき差分がないか自分のブランチで確認
git checkout 自分のブランチ
git merge
新しいブランチがあるかもしれません。
マージ前確認コマンド
例(main に 9-feature001 をマージする前):
git diff --stat main..9-feature001
実践編
サブモジュール更新実践編
現在のサブモジュールの向き先
[root@gitlab176 bbbproject ((6f63bad...))]# git branch -a
* (HEAD detached at 6f63bad)
2-feature001
main
remotes/origin/2-feature001
remotes/origin/HEAD -> origin/main
remotes/origin/main
サブモジュールの向き先の部屋にcheckout
[root@gitlab176 bbbproject ((6f63bad...))]# git checkout 2-feature001
Previous HEAD position was 6f63bad Merge branch '1-bbb001' into 'main'
Switched to branch '2-feature001'
Your branch is up to date with 'origin/2-feature001'.
部屋を切り替えたら一段上に戻ります
[root@gitlab176 bbbproject (2-feature001)]# cd ../
[root@gitlab176 testzzz (9-feature001 *)]# ll
取り込み前事前確認
[root@gitlab176 testzzz (9-feature001 *)]# git status
On branch 9-feature001
Your branch is up to date with 'origin/9-feature001'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: bbbproject (new commits)
取り込みます
[root@gitlab176 testzzz (9-feature001 *)]# git add bbbproject
コミットします。
[root@gitlab176 testzzz (9-feature001 +)]# git commit -m "bbbproject renewal"
[9-feature001 a557259] bbbproject renewal
1 file changed, 1 insertion(+), 1 deletion(-)
git pushします。
[root@gitlab176 testzzz (9-feature001)]# git push http://192.168.2.176/kenken/testzzz.git/
(gnome-ssh-askpass:16797): Gtk-WARNING **: 09:24:57.916: cannot open display: localhost:10.0
error: unable to read askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'
Username for 'http://192.168.2.176': kenken
(gnome-ssh-askpass:16803): Gtk-WARNING **: 09:25:04.565: cannot open display: localhost:10.0
error: unable to read askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'
Password for 'http://kenken@192.168.2.176':
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 252 bytes | 252.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for 9-feature001, visit:
remote: http://192.168.2.176/kenken/testzzz/-/merge_requests/new?merge_request%5Bsource_branch%5D=9-feature001
remote:
To http://192.168.2.176/kenken/testzzz.git/
5ed1649..a557259 9-feature001 -> 9-feature001
pushできたらGUIで確認しましょう
他のブランチへのマージ実践編
マージ前確認
[root@gitlab176 testzzz (7-renewal001)]# git diff --stat 7-renewal001..9-feature001
bbbproject | 2 +-
time.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
マージ実行
[root@gitlab176 testzzz (7-renewal001)]# git merge 9-feature001
Updating 00ff43f..a557259
Fast-forward
bbbproject | 2 +-
time.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
差分が出ている、これはサブモジュール側が最新化されていないよって意味
ここでgit addしたら先祖帰り。ややこしい
[root@gitlab176 testzzz (7-renewal001 *)]# git status
On branch 7-renewal001
Your branch is ahead of 'origin/7-renewal001' by 3 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: bbbproject (new commits)
no changes added to commit (use "git add" and/or "git commit -a")
サブモジュールをアップデート ポインタが更新されました。ややこしい
[root@gitlab176 testzzz (7-renewal001 *)]# git submodule update
Submodule path 'bbbproject': checked out 'f9adb0421933d6be429a525bdc8ac2ec2cf1a997'
cd サブモジュールに移動
ポインタが'f9adb0421933d6be429a525bdc8ac2ec2cf1a997'に更新されていました。
GUIからの確認でもよいと思います。










