Git安装部署[二]
Gitlab
Git介绍
开源免费的分布式版本控制系统(DVCS)
Git的主要特点
支持离线工作,多点同步
速度快
使用40位哈希值标示版本号
本地库、缓冲区、中心库三层结构
本地库:中心库的完整镜像(.git目录)
缓存区:用于存放和整理待提交改动的空间,支持选择性提交(.git/index)
中心库:代码托管服务器管理下的git库
轻量级的分支和标签
working directory
-->git add
staging area
-->git commit
repository
working directory---staging area--->repository (git commit -a)
commit-id
40位的哈希值,全球唯一的标示一次提交的完整镜像,相当于一个快照
HEAD
指代当前checkout状态的commit,后续commit都基于它完成,类似链表
refs
分支管理的命名空间,



http://code.greatops.net/greatops/practice-code.git

修改gitlab url的步骤 1. 编辑 /root/data/gitlab/config/gitlab.rb 2. 修改 external_url 'http://106.2.3.227' 这个配置默认是注释掉的 3. 进入gitlab容器 docker exec -it devops_gitlab_1 bash 4. 重新加载配置 gitlab-ctl reconfigure 5. 重启gitlab gitlab-ctl restart






下载代码
http的方式
[root@linux-node2 ~]# cd /root/devops/ [root@linux-node2 devops]# mkdir -pv workspace mkdir: created directory ‘workspace’ [root@linux-node2 devops]# cd workspace [root@linux-node2 workspace]# git clone http://192.168.56.12/devops/account.git Cloning into 'account'... Username for 'http://192.168.56.12': root Password for 'http://root@192.168.56.12':
ssh的方式
ssh-keygen -t rsa -C root@devops.com Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): 一直回车 Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 05:97:6a:f6:3a:6c:ce:f9:2b:9f:88:22:23:74:38:8d root@devops.com The key's randomart image is: +--[ RSA 2048]----+ | . .. | | o. | | .. | | +. | | + oS. | | E o . | |. o . . | |. o . o*o . | | . o ..o===. | +-----------------+
私钥和公钥
[root@linux-node2 ~]# ll ~/.ssh/ total 8 -rw------- 1 root root 1675 Dec 7 20:11 id_rsa -rw-r--r-- 1 root root 397 Dec 7 20:11 id_rsa.pub [root@linux-node2 ~]# cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDI3lQi7zLfd68rhqrjJW8qZpArpoKlPecBwCPzLINOIUMHYZqozN4bbB6NeeFhgEEHELnikF0KdnIjZEo5n9znxdUduWHi1AF/CWm3qYVUzc+bq4QYJt5IrgcMi7jFTw00MAR4Yee/gHvcKttyiLqfxcJKywOvsZhGqP/D4GHa6c/NPiXTJZFY7fiPEsY9rK0fOFDV1Sf7xfzefe0kZe9EQUgyNgY6rk8ToNGuBAe4dP35VYwJsrCHuOJ4TEYxlxaOyyiEkkVoUpyRxEiPJXvJk77CmTbrU9oIH+U5Sknfg1xmJkgFdhK3tK4vNDJ006TxeShWz3gqTLfttYnV/rsv root@devops.com


ssh下载代码
[root@linux-node2 workspace]# pwd /root/devops/workspace [root@linux-node2 workspace]# git clone git@192.168.56.12:devops/account.git account-ssh Cloning into 'account-ssh'... The authenticity of host '192.168.56.12 (192.168.56.12)' can't be established. ECDSA key fingerprint is 59:4b:21:14:d1:9d:6f:38:fa:56:d6:d8:fa:af:72:00. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.56.12' (ECDSA) to the list of known hosts. remote: Counting objects: 217, done. remote: Compressing objects: 100% (87/87), done. remote: Total 217 (delta 63), reused 217 (delta 63) Receiving objects: 100% (217/217), 88.45 KiB | 0 bytes/s, done. Resolving deltas: 100% (63/63), done. [root@linux-node2 workspace]# ll total 4 drwxr-xr-x 9 root root 4096 Dec 7 20:22 account-ssh

浙公网安备 33010602011771号