在centos7输入如下命令:
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://gitlab.66xundian.com" yum install -y gitlab-ee(个人理解网址要绑定linux系统对应的ip地址,访问这个网址就可以访问gitlab).
结束
(sudo vim /etc/gitlab/gitlab.rb)vi /etc/gitlab/gitlab.rb(cd /opt/gitlab/embedded/service/gitlab-rails/config)
(vi gitlab.yml))(gitlab-ctl reconfigure)
使用vi编辑器, 按 insert键插入,进入编辑模式
如本例中改成 1.118. 按下esc 键。
输入 冒号:wq 保存退出
修改ip地址:
vi /etc/gitlab/gitlab.rb
vi /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
配置git账号和邮箱
git config --global user.name "XXXX"
git config --global user.email "XXXX"
查看用户名、邮箱命令
$ git config user.name
配置ssh
git config --global user.email XX@qq.com
git config --global user.name zhangsan
ssh-keygen -t rsa -C "XX@qq.com"
解决冲突选
(选择分支进行上传
Git master branch has no upstream branch的解决
git push -u origin test
git pull origin test)
git clone XX
cd mycard
git checkout -b test origin/test 切换分支
vim hello.txt
git add . && git commit -m "修改hello"
git push(选择分支就这样git push -u origin test)
git pull(选择分支就这样git pull origin test)
vim hello.txt
git commit -a
git push
git merge test
git push
1 查看远程分支
git branch -a
查看本地分支
git branch
创建分支
git branch test
线面是把分支推到远程分支
$ git push origin test
删除远程分支
git branch -r -d origin/branch-name
git push origin :branch-name
选中分支
git checkout test
(git checkout -b test origin/test)
上传项目
git config --global user.name "椰子"
git config --global user.email "995852922@qq.com"
git init
git remote add origin ssh://git@42.123.127.93:10022/tyshawn/sdap1.git
git add .
git commit -m "程序源代码"
git push -u origin master