More Related Content Similar to 今さら聞けない人のためのGit超入門 GitLab 13対応版 (20) More from VirtualTech Japan Inc./Begi.net Inc. (20) 今さら聞けない人のためのGit超入門 GitLab 13対応版2. 自己紹介
• 本名:宮原 徹
• 1972年1月 神奈川県生まれ
• 1994年3月 中央大学法学部法律学科卒業
• 1994年4月 日本オラクル株式会社入社
– PCサーバ向けRDBMS製品マーケティングに従事
– Linux版Oracle8の日本市場向け出荷に貢献
• 2000年3月 株式会社デジタルデザイン 東京支社長および株
式会社アクアリウムコンピューター 代表取締役社長に就任
– 2000年6月 (株)デジタルデザイン、ナスダック・ジャパン上場(4764)
• 2001年1月 株式会社びぎねっと 設立
• 2006年12月 日本仮想化技術株式会社 設立
• 2008年10月 IPA「日本OSS貢献者賞」受賞
• 2009年10月 日中韓OSSアワード 「特別貢献賞」受賞
• ガンダム勉強会主宰・好きなモビルスーツはアッガイ
2
4. 日本仮想化技術株式会社 概要
• 社名:日本仮想化技術株式会社
– 英語名:VirtualTech Japan Inc.
– 略称:日本仮想化技術/VTJ
• 設立:2006年12月
• 資本金:3,000万円
• 売上高:18,167万円(2019年7月期)
• 本社:東京都渋谷区渋谷1-8-1
• 取締役:宮原 徹(代表取締役社長兼CEO)
• 伊藤 宏通(取締役CTO)
• スタッフ:8名(うち、6名が仮想化技術専門エンジニアです)
• URL:http://VirtualTech.jp/
• 仮想化技術に関する研究および開発
– 仮想化技術に関する各種調査
– 仮想化技術を導入したシステムの構築・運用サポート
– OpenStackの導入支援・新規機能開発・運用サポート
– 自動化・DevOps支援
ベンダーニュートラルな
独立系仮想化技術の
エキスパート集団
4
20. GitLabをインストールする
• 「Official Linux package (recommended
installation)」を参考に環境を構築
– Kubernetesやクラウド上へのインストールも可能
1. GitLabのWebページ(https://about.gitlab.com/)の
メニューから「Install GitLab」を選択
2. インストールしたいOS・環境を選択
3. 手順に従ってインストール
20
21. CentOS 8.1へのインストール
1. sudo yum install -y curl policycoreutils-python openssh-server
2. sudo systemctl enable sshd
3. sudo systemctl start sshd
4. sudo firewall-cmd --permanent --add-service=http
5. sudo systemctl reload firewalld
6. curl
https://packages.gitlab.com/install/repositories/gitlab/gitlab-
ce/script.rpm.sh | sudo bash
7. sudo EXTERNAL_URL="http://gitlab.example.com" yum
install -y gitlab-ce
注)逆引き名前解決でコケるとconfigに失敗します
8. sudo EXTERNAL_URL="http://gitlab.example.com" gitlab-
ctl reconfigure
21
←必ず実行
22. GitLab 13インストールの注意点
• Let's EncryptによるTLS化がデフォルトに
– ドキュメントでのインストール時の
EXTERNAL_URLの指定が"https://○○"に
→オンプレ、ローカルIPアドレスだとLet's Encrypt
のTLS証明書生成がコケてインストール失敗
– EXTERNAL_URLの指定を"http://○○"に
• DNSの逆引き名前解決の設定が必要
– /etc/hostsではダメ
– インストールスクリプト(Chef利用)がコケるので、
gitlab-ctl reconfigureの実行が必要
22
32. リポジトリにファイルを追加
1. 作業ディレクトリにファイルを追加
– $ touch README.md
2. ファイルをステージング
– $ git add README.md
3. ステージングしたファイルをコミット
– $ git commit
4. コミットしたファイルをリモートにプッシュ
– 同時にローカルリポジトリのアップストリーム設定
– $ git push --set-upstream origin master
• masterブランチのアップストリームをリモートリポジトリの
master(remotes/origin/master)に設定
32
33. リポジトリ操作実行例
$ touch README.md
$ git add README.md
$ git commit
[master f439952] touch test
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
$ git push --set-upstream origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 248 bytes | 248.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://gitlab.example.com/tmiyahar/test.git
1285f2f..f439952 master -> master
Branch master set up to track remote branch master from origin.
33
35. ブランチを作成する
1. ブランチの確認
– $ git branch
– 現時点ではローカルのmasterだけ
2. ブランチの作成
– $ git branch develop
3. ブランチの切り替え(チェックアウト)
– $ git checkout develop
– $ git checkout –b develop で作成&移動も
4. ブランチの確認
– $ git branch
– 作業しているブランチがdevelopに変更されている
35
36. ブランチ作成実行例
$ git branch
* master
$ git branch develop
$ git checkout develop
Switched to branch 'develop'
develop branch
$ git branch
* develop
master
36
42. git push 失敗
$ git push
To http://gitlab.example.com/tmiyahar/test.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'http://gitlab.example.com/tmiyahar/test.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
42
43. git pullするとコンフリクト発生
$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From http://gitlab.example.com/tmiyahar/test
88ac94f..db377a7 master -> origin/master
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
43