|NO.Z.00023|——————————|NavigationLog|——|Git.Linux客户端配置|

一、安装git客户端并配置
### --- 安装git客户端

~~~		# 配置git.repo源
[root@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
~~~		# 安装git客户端

[root@gitlab ~]# yum install -y git
### --- 生成ssh-key秘钥
### --- 将秘钥导入到gitlab上

~~~		# 生成主机秘钥
[root@gitlab ~]# ssh-keygen
~~~		# 查看生成的秘钥
[root@gitlab ~]# ls .ssh/
authorized_keys  id_rsa  id_rsa.pub  known_hosts
二、配置客户端,进行数据交互
### --- 配置git客户端

~~~		# 配置git客户端
[root@gitlab ~]# git config --global user.name "xxx"
[root@gitlab ~]# git config --global user.email "yyy"
### --- 上传代码到gitlab中

~~~		# 上传代码到gitlab中
[root@gitlab ~]# git clone git@${gitaddr}:${username}/${projectname}.git
[root@gitlab ~]# cd ${projectname}
[root@gitlab ~]# touch README.md
[root@gitlab ~]# git add README.md
[root@gitlab ~]# git commit -m "add README"
[root@gitlab ~]# git push -u origin master
三、git常用操作
### --- push项目到远程仓库

~~~		# 显示所有文件
[root@gitlab ~]# git submodule update --init --recursive
~~~		# 查看当前项目在哪个分支下
 
[root@k8s-master01 ~]# git status
# On branch master
~~~		# 新建分支pipeline-test

[root@k8s-master01 ~]# git checkout -b pipeline-test
Switched to a new branch 'pipeline-test'
~~~		# 删除分支

[root@k8s-master01 ~]# git branch -d pipeline-test
~~~		# 删除无用的项目
~~~		# push项目到gitlab中

[root@k8s-master01 spring-cloud-demo]# git add . --all
[root@k8s-master01 spring-cloud-demo]# git commit -am "First Submission"
[root@k8s-master01 spring-cloud-demo]# git config --global user.email "yanqi_vip@yeah.net"
[root@k8s-master01 spring-cloud-demo]# git config --global user.name "yanqivip"
[root@k8s-master01 spring-cloud-demo]# git push origin pipeline-test
### --- 常用操作

~~~		# 查看当前项目下所有分支
[root@gitlab ~]# git branch -a
~~~		# 切换分支
[root@gitlab ~]# git checkout remotes/origin/release-0.10

附录一:
operationlog
Linux
zabbix
nginx
mysql
Java
Java-git
lbc/hac
Jenkins
CICD
kubernetes
database

yanqivip
yanqi-java
yanqi-cloud
yanqi-storage
yanqi-CI/CD
yanqi-kubernetes
yanqi-operations

data-experiment
data-eureka
data-nodejs
data-kubernetes

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(11)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示