1. 事前に準備する
1.1 依存ツールのインストール
yum install -y curl policycoreutils-python openssh-server
systemctl start sshd
systemctl enable sshd
1.2 Postfixメールサーバーのインストール
#安装 postfix
yum install -y postfix
#启动 postfix 并设置为开机启动
systemctl enable postfix
systemctl start postfix
1.3 ファイアウォールをオフにする
systemctl stop firewalld
systemctl disable firewalld
2. インストール
2.1 国内のgitlabミラーソースを追加
--no-check-certificate パラメータは、SSL 証明書をチェックしないことを意味します
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm --no-check-certificate
インストール
rpm -ivh gitlab-ce-13.1.2-ce.0.el7.x86_64.rpm
2.2 設定ファイルを変更する
ポート番号を 8081 に変更します。
2.3 ログイン
![](https://img-blog.csdnimg.cn/img_convert/6273713a25095674412ef81c17875a87.png)
アカウント: root
パスワード: lgblgblgb (これは私が設定したパスワードです。同じである必要はありません)
ファイル /etc/gitlab/initial_root_password のパスワードを確認します。ファイルが存在しない場合は、ページで新しい root パスワードを直接変更するよう案内されるため、確認する必要はありません。
cat /etc/gitlab/initial_root_password
2.4 関連コマンド
gitlab-ctl start // 启动所有 gitlab 组件;
gitlab-ctl stop // 停止所有 gitlab 组件;
gitlab-ctl restart // 重启所有 gitlab 组件;
gitlab-ctl status // 查看服务状态;
gitlab-ctl reconfigure // 刷新配置文件;
vim /etc/gitlab/gitlab.rb // 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace // 检查gitlab;
gitlab-ctl tail // 查看日志;
2.5 セット中国語
アバターアイコンをクリックし、「設定」を選択し、「環境設定」列で「環境設定」を選択し、プルダウンして「ローカリゼーション」領域を見つけ、「英語」オプションを「中国語、簡体字-簡体字中国語」に変更し、「」をクリックします。変更内容を保存"。
3. Javaプロジェクトをアップロードする
状態:
ホストは jdk と idea をインストールしました
ホストは git をインストールしました
ホスト マシンには、アップロードできる完全なテスト プロジェクトが含まれています
2.1 win10 インストール jdk1.8 と idea2019
2.2 gitをインストールする
2.3 Java プロジェクトを作成するためのアイデア
2.4 タイムサーバーを確認する
date #在giatlab服务器终端执行,如果时间为北京时间进行下一步,如果是美国时间,先安装时间同步服务。
yum -y install chrony
cp -a /etc/chrony.conf /etc/chrony.conf.bak
sed -i 's/server/#server/g' /etc/chrony.conf
sed -i '/#server 3.centos.pool.ntp.org iburst/a\server ntp1.aliyun.com iburst' /etc/chrony.conf
systemctl restart chronyd
systemctl enable chronyd
systemctl enable chronyd #重启gitlab
![](https://img-blog.csdnimg.cn/img_convert/ffa7685033223841a4ae7c2daa939682.png)
2.5 Gitlab 管理者が新しい LuoGuiBin ユーザーを作成する
root ユーザーの下に新しい GuoGuiBin アカウントを作成します。
![](https://img-blog.csdnimg.cn/img_convert/ada0b0edeb5b868924dee756772dfbea.png)
情報を入力してください。電子メールは必須です
![](https://img-blog.csdnimg.cn/img_convert/74a00cb68cb56d60d68d3a2e34a19c08.png)
2.6 gitlab の新しいウェアハウス
新しく作成した LuoGuiBin アカウントを変更するにはログインする必要があることに注意してください。
![](https://img-blog.csdnimg.cn/img_convert/620db8610d5652caafc0093923dc1987.png)
![](https://img-blog.csdnimg.cn/img_convert/6f5736517bce0aa6a8fe7cc9c9628f2c.png)
2.7 ユーザーとメールボックスの設定、ssh キーの取得
ホストのプロジェクト フォルダー E:\java\java_test を右クリックし、[Git Bash Here] を選択すると、ポップアップ ウィンドウが表示されます。プロジェクトフォルダーに入らないように注意してください。
![](https://img-blog.csdnimg.cn/img_convert/0b25bf6d61942b97301e3706eeef2eac.png)
![](https://img-blog.csdnimg.cn/img_convert/85f2e44e86c31c126090020ddc46ad98.png)
ユーザーとメールボックスを変更した後、コマンドの入力後にプロンプトは表示されず、コマンドが正常に実行されたことが示されます。
git config --global user.name “xxx”
git config --global user.email “[email protected]”
![](https://img-blog.csdnimg.cn/img_convert/47c9599c6e62e367f7747b2c443323e2.png)
![](https://img-blog.csdnimg.cn/img_convert/7b41a9a982581e90bcf32474d1195ffa.png)
ssh-keygen -t rsa -C “[email protected]” #连按三次enter获得秘钥
![](https://img-blog.csdnimg.cn/img_convert/be5f7afb126f67923edec2ca838ed9e1.png)
![](https://img-blog.csdnimg.cn/img_convert/414cdc819a6a6ed57bc58d7ab2f1a119.png)
.ssh フォルダーに入ったら、メモ帳で id_rsa.pub ファイルを開き、コピーして、Gitlab に SSH キーを追加します。
![](https://img-blog.csdnimg.cn/img_convert/a4465228c00a534e646608e959bb4a78.png)
![](https://img-blog.csdnimg.cn/img_convert/992d7fc6dd56cd7fb0c736d04d06015c.png)
有些博客使用ssh -T [email protected]测试是否成功,即使失败也不影响,这张图就是失败效果。
![](https://img-blog.csdnimg.cn/img_convert/73dea6192a94b099e53885679673395b.png)
2.8初始化init
git init
出现提示后文件夹会生成一个.git的隐藏文件夹,且会出现(master)分支。
![](https://img-blog.csdnimg.cn/img_convert/8f0c02bd5c9366852a2cbaee0fed90e6.png)
![](https://img-blog.csdnimg.cn/img_convert/b551a1b13f8ea5a382ded9b2b24b33ea.png)
克隆仓库地址
![](https://img-blog.csdnimg.cn/img_convert/e0c74c0e76044f6a6442e59f944bcccd.png)
#git remote add origin 仓库地址
git remote add origin http://192.168.136.51:8081/LuoGuiBin/hello_world.git
ip、端口、用户名可能会不同,需要留意自己的。
我现在以file.txt为例子,
上传前file.txt内容为123。
![](https://img-blog.csdnimg.cn/img_convert/7dbd7d207ba0e6c0cec3e6dcde00828e.png)
![](https://img-blog.csdnimg.cn/img_convert/faa4c4f8761ef600db5bcace66536328.png)
2.9开始上传
2.9.1上传测试file
file原本的内容三123,将file更改成12345,上传gitlab,查看是否上传成功。
![](https://img-blog.csdnimg.cn/img_convert/0badbcf8d5832cad76d37343b59f9732.png)
git status #查看提交状态
git add file.txt
#该文件添加入track中,使用git add . 命令可以将当前文件夹下的所有文件添加到stack中。
git commit -m "change_file_12345" #上传注释
git push -u origin master
![](https://img-blog.csdnimg.cn/img_convert/3e446536bc6c3204082665557c111a47.png)
再次查看gitlab上的file.txt文件,已经更新成12345,上传完成,其他项目文件夹上传都是相同的步骤。
![](https://img-blog.csdnimg.cn/img_convert/f67bb0e87a0d52405f379b866b97f5cf.png)
![](https://img-blog.csdnimg.cn/img_convert/1ceb69d72366d900eac124a027526c64.png)