gitlab部署

centos中部署gitlab

安装sshd

yum install -y curl policycoreutils-python openssh-server
systemctl enable sshd
systemctl start sshd

配置防火墙

vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
vim /etc/sysctl.conf

systemctl enable firewalld
systemctl start firewalld

防火墙对http放行
firewall-cmd --permanent --add-service=http
systemct reload firewalld

安装 postfix

GitLab 需要使用 postfix 来发送邮件。也可以使用 SMTP 服务器。
yum install -y postfix

vim /etc/postfix/main.cf
119 inet_protocols = ipv4
需要将all改成ipv4
启用postfix
systemctl enable postfix
systemctl start postfix

安装gitlab

将源改为国内源
vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1

yum clean all
yum makecache fash
yum -y install gitlab-ce --nogpgcheck

安装完成后修改配置文件
vim /etc/gitlab/gitlab.rb
在大概32行修改成   http://192.168.5.6:8090
初始化gitlab
gitlab-ctl reconfigure
启动gitlab
gitlab-ctl start
重启 gitlab
gitlab-ctl restart 
查看gitlab状态
gitlab-ctl status

修改配置文件后一定要初始化后再进行重启操作
gitlab-ctl reconfigure
gitlab-ctl restart 

登录

http://192.168.5.6:8090/
用户名:root
进去以后修改密码,这个24小时后会删除
密码;
cat /etc/gitlab/initial_root_password

# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: FILZ2PFZmg0uw5c8aBdHahx1Nx9xcEz5MZo+lFYjuxQ=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

web界面修改成中文

在这里插入图片描述
在这里插入图片描述

配置git进行项目传输

配置秘钥

 ssh-keygen -t rsa -C "gitlab用户名"
 cd ~/.ssh
 将生成的id_rsa.pub,将文件里面的秘钥添加到

在这里插入图片描述

通过git将项目传到gitlab中

git init
git remote add origin  项目地址
git add .
git commit -m "测试git上传项目"
git push -uf origin main

在这里插入图片描述

git上传遇到的问题

在这里插入图片描述

 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to

需要
git pull --rebase origin main
然后
git init
git add .
git commit -m "测试git上传项目"
在windows上用git上传的话会看到
Administrator@DESKTOP-4Q366NS MINGW64 /d/项目/yolov5_main (main|REBASE 1/2)
执行git rebase --continue
会看到 (main|REBASE 1/2)变成main
然后重新进行上传
git push -uf origin main

在这里插入图片描述

上图标记的一定要和远程仓库的分支名称一样
不一样需要切换过来
git branch -m master main
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

weixin_51711897

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值