1.复制远程仓库地址
2.根据提示选择默认添加仓库(如果没有仓库则创建)
创建仓库
#安装git软件
[root@gitlab ~]# yum install -y git
#配置git
[root@gitlab ~]# git config --global user.name "lx"
[root@gitlab ~]# git config --global user.email "lixian656@qq.com"
[root@gitlab ~]# git config --global color.ui true
[root@gitlab ~]# git config --list
user.name=lx
user.email=lixian656@qq.com
color.ui=true
#创建项目目录
[root@gitlab ~]# mkdir tlbb
#git初始化
[root@gitlab ~]# cd tlbb/
[root@gitlab ~/tlbb]# git init
Initialized empty Git repository in /root/tlbb/.git/
[root@gitlab ~/tlbb]# ls -a
. .. .git
#创建文件并添加到git暂存区
[root@gitlab ~/tlbb]# touch {1..3}.lx
[root@gitlab ~/tlbb]# ls
1.lx 2.lx 3.lx
[root@gitlab ~/tlbb]# git add *
[root@gitlab ~/tlbb]# git commit -m "add lx file"
[master (root-commit) 084030d] add lx file
3 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 1.lx
create mode 100644 2.lx
create mode 100644 3.lx
#创建远程仓库并推送到远程仓库
[root@gitlab ~/tlbb]# git remote #没有输出结果就没有仓库
[root@gitlab ~/tlbb]# git remote add origin git@10.0.0.100:Dev/tlbb.git #创建origin仓库 地址填写刚才复制的gitlab链接
[root@gitlab ~/tlbb]# git remote
origin
[root@gitlab ~/tlbb]# git push -u origin master #推送仓库
The authenticity of host '10.0.0.100 (10.0.0.100)' can't be established.
ECDSA key fingerprint is SHA256:60WNoACIC/+M/69M2SrCLe4k5qYpKaEVqsoUmqGubnI.
ECDSA key fingerprint is MD5:0a:e8:0d:c9:35:83:7e:15:17:5f:0c:b8:0e:c2:ce:f9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.100' (ECDSA) to the list of known hosts.
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 207 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@10.0.0.100:Dev/tlbb.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
3.查看gitlab-web仓库