GitLab配置免密登录和常用命令

SSH 免密登录

Windows免密登录

  1. 删除现有Key

访问目录:C:\Users\Administrator\ .ssh,删除公钥:id_rsa.pub ,私钥:id_rsa

2.生成.ssh 秘钥

运行命令生成.ssh 秘钥目录( ssh-keygen -t rsa -C xxxxxx@126.com),三次回车

复制代码
C:\Users\Z1561> ssh-keygen -t rsa -C xxxxxx@126.com
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Z1561/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Z1561/.ssh/id_rsa
Your public key has been saved in C:\Users\Z1561/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:Fssi9uVFvEYt+DykW7xJDW8jra56arh+bGbFgsyfT3c xxxxxx@126.com
The key's randomart image is:
+---[RSA 3072]----+
|                 |
|         o .     |
|        o B .    |
|       . @ B     |
|   oo...S % *    |
|   .+o.=o* B .   |
|     +.++ = E    |
|    . X..o .     |
|   .oBo=o..      |
+----[SHA256]-----+
​
C:\Users\Z1561>

GitHub配置SSH

登录 GitHub,点击用户头像→Settings→SSH and GPG keys

参考:DevOps - GitHub 代码托管平台_github 测试管理平台-CSDN博客

配置参考链接: DevOps - Git 版本管理_devops 代码版本管理-CSDN博客

常用命令

克隆远程仓库到本地

git clone http://192.168.96.22:9093/java-group/test-group.git

分支切换

复制代码
[root@qfedu.com ~]# git checkout develop     #切换develop分支

代码提交

[root@qfedu.com](mailto:root@qfedu.com) \~# git add main.cpp # 将某一个文件添加到暂存区

[root@qfedu.com](mailto:root@qfedu.com) \~# git add . # 将文件夹下的所有的文件添加到暂存区

[root@qfedu.com](mailto:root@qfedu.com) \~# git commit -m 'note' # 将暂存区中的文件保存成为某一个版本

[root@qfedu.com](mailto:root@qfedu.com) \~# git log # 查看所有的版本日志

[root@qfedu.com](mailto:root@qfedu.com) \~# git status # 查看现在暂存区的状况

git push origin develop 提交代码到develop 分支

git pull origin develop 更新develop 分支代码

...待验证

合并分支

...待补充

提交代码需要token,解决方案

进入设置setting -> 找到插件Plugins -> 搜索gitlab -> 点击 Disable,禁用gitlab插件

应用以上设置后,再次克隆代码,即可使用账号密码进行登录。

相关推荐
ElevenS_it1885 分钟前
Nginx日志监控告警实战:access_log解析+5xx突增+慢请求+异常IP自动告警完整方案(Filebeat+Zabbix)
运维·网络·tcp/ip·nginx·zabbix
liulilittle41 分钟前
Linux Swap 文件配置与持久化(虚拟内存)
linux·运维·服务器
未若君雅裁43 分钟前
日志采集与ELK:从本地日志到集中检索分析
运维·elk·jenkins
零陵上将军_xdr1 小时前
从沙子到CPU——计算机硬件基础入门
linux·运维·硬件架构
vortex51 小时前
Linux 命令工具箱:util-linux 与 GNU Coreutils
linux·运维·gnu
AIex-YH1 小时前
三域贯通11/12:生物制造的“死亡之谷“,CDMO 是桥还是船?
运维·制造·策略模式
荒--1 小时前
MSF 使用
linux·运维·服务器
明航咨询-程老师1 小时前
信创运维困局:“救火队”模式走到尽头,平台工程如何重塑CISAW安全体系?
运维·安全·数据安全官,ccrc 认证,数据合规,职业发展规划
w3296362712 小时前
八、OpenCode 高阶玩法:CLI 自动化、CI/CD 集成与远程协作
运维·ci/cd·自动化·ai编程·开发工具·opencode
烁3472 小时前
liunx命令不完整版
linux·运维·服务器