git
安装
安装git
[root@localhost ~]# yum -y install epel-release git vim
[root@localhost ~]# yum -y install curl openssh-server openssh-clients postfix cronie perl policycoreutils-python-utils
//安装依赖包
开机自启postfix
[root@localhost ~]# systemctl restart postfix
[root@localhost ~]# systemctl enable postfix
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.
[root@localhost ~]#
[root@localhost ~]# ls
anaconda-ks.cfg Desktop Documents Downloads gitlab-ce-16.9.2-ce.0.el9.x86_64.rpm Music Pictures Public Templates Videos
[root@localhost ~]# rpm -ivh gitlab-ce-16.9.2-ce.0.el9.x86_64.rpm
warning: gitlab-ce-16.9.2-ce.0.el9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:gitlab-ce-16.9.2-ce.0.el9 ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=16-9
[root@localhost ~]#
//修改配置文件
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.100.240'
启gitlab
[root@localhost ~]# gitlab-ctl reconfigure
//Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
gitlab Reconfigured!
//重启服务
[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 42307) 0s
ok: run: gitaly: (pid 42319) 1s
ok: run: gitlab-exporter: (pid 42343) 0s
ok: run: gitlab-kas: (pid 42358) 1s
ok: run: gitlab-workhorse: (pid 42371) 0s
ok: run: logrotate: (pid 42386) 0s
ok: run: nginx: (pid 42392) 1s
ok: run: node-exporter: (pid 42404) 0s
ok: run: postgres-exporter: (pid 42410) 1s
ok: run: postgresql: (pid 42419) 0s
ok: run: prometheus: (pid 42428) 1s
ok: run: puma: (pid 42444) 0s
ok: run: redis: (pid 42449) 0s
ok: run: redis-exporter: (pid 42456) 1s
ok: run: sidekiq: (pid 42470) 1s
[root@localhost ~]# gitlab-ctl status
run: alertmanager: (pid 42307) 30s; run: log: (pid 41679) 888s
run: gitaly: (pid 42319) 30s; run: log: (pid 40812) 1022s
run: gitlab-exporter: (pid 42343) 29s; run: log: (pid 41402) 913s
run: gitlab-kas: (pid 42358) 18s; run: log: (pid 41083) 1010s
run: gitlab-workhorse: (pid 42371) 17s; run: log: (pid 41262) 931s
run: logrotate: (pid 42386) 17s; run: log: (pid 40704) 1034s
run: nginx: (pid 42392) 17s; run: log: (pid 41319) 924s
run: node-exporter: (pid 42404) 16s; run: log: (pid 41365) 919s
run: postgres-exporter: (pid 42410) 16s; run: log: (pid 41697) 884s
run: postgresql: (pid 42419) 15s; run: log: (pid 40898) 1016s
run: prometheus: (pid 42428) 15s; run: log: (pid 41476) 901s
run: puma: (pid 42444) 14s; run: log: (pid 41172) 942s
run: redis: (pid 42449) 14s; run: log: (pid 40774) 1026s
run: redis-exporter: (pid 42456) 14s; run: log: (pid 41443) 905s
run: sidekiq: (pid 42470) 8s; run: log: (pid 41198) 935s
[root@localhost ~]#
//开机自启
[root@localhost ~]# gitlab-ctl stop
[root@localhost ~]# systemctl enable --now gitlab-runsvdir
[root@localhost ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 4096 127.0.0.1:631 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9168 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9187 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9093 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9090 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9100 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9121 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9236 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:9229 0.0.0.0:*
LISTEN 0 511 0.0.0.0:80 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 511 0.0.0.0:8060 0.0.0.0:*
LISTEN 0 128 127.0.0.1:6010 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:8150 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:8151 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:8153 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:8154 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:8155 0.0.0.0:*
LISTEN 0 1024 127.0.0.1:8082 0.0.0.0:*
LISTEN 0 1024 *:9094 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 128 [::1]:6010 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
LISTEN 0 1024 [::1]:9168 [::]:*
LISTEN 0 4096 [::1]:631 [::]:*
[root@localhost ~]#
//版本
[root@localhost ~]# cat /opt/gitlab/version-manifest.txt
gitlab-ce 16.9.2
!
破解密码
//破解密码
[root@localhost ~]# gitlab-rails console -e production
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root> //创建用户,id1就是超级管理员
irb(main):002:0> user.password = 'ysy2024322'
=> "ysy2024322" //输入新密码
irb(main):003:0> user.password_confirmation='ysy2024322'
=> "ysy2024322" //确认密码
irb(main):004:0> user.save! //保存修改
=> true
irb(main):005:0> exit //退出
验证
创建项目
//Admin area切换Your work
上传
[root@localhost ~]# git config --global user.name "Administrator"
[root@localhost ~]# git config --global user.email "admin@example.com"
[root@localhost ~]# git clone http://192.168.100.240/root/test.git
Cloning into 'test'...
Username for 'http://192.168.100.240': root
Password for 'http://root@192.168.100.240':
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
[root@localhost ~]#
[root@localhost test]# git switch --create main
fatal: a branch named 'main' already exists
[root@localhost test]# echo "hello world" > xx
[root@localhost test]# git add .
[root@localhost test]# git commit -m "first commit"
[main 23ca125] first commit
1 file changed, 1 insertion(+)
create mode 100644 xx
[root@localhost test]#
[root@localhost test]# git push --set-upstream origin main
Username for 'http://192.168.100.240': root
Password for 'http://root@192.168.100.240':
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 278 bytes | 278.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To http://192.168.100.240/root/test.git
a6fd706..23ca125 main -> main
branch 'main' set up to track 'origin/main'.
[root@localhost test]#
[root@localhost ~]# git clone http://192.168.100.240/root/test.git
Cloning into 'test'...
Username for 'http://192.168.100.240': root
Password for 'http://root@192.168.100.240':
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done.
[root@localhost ~]# ls
anaconda-ks.cfg Desktop Documents Downloads gitlab-ce-16.9.2-ce.0.el9.x86_64.rpm Music Pictures Public Templates test Videos
[root@localhost ~]# cat test/xx
hello world
[root@localhost ~]#
组
用户
添加组
//编辑项目内容
//新建文件
//上传文件