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插件

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

相关推荐
lys0796200040 分钟前
多台亚马逊云服务器,在同一个网段的办法
运维·服务器
2601_9632827742 分钟前
极寒场景专网通信技术实践:黑龙江零下 40℃环境数字对讲组网方案落地解析
大数据·运维·数据库
沫璃染墨2 小时前
《从零入门Linux系统篇(十四):系统工具篇·五——Git版本控制:从版本管理到协同开发》
linux·运维·服务器·git·gitee·github
元岳数字人小元3 小时前
数字人开源技术优势解析,助力智能交互普及落地
运维·人工智能·开源·人机交互·交互
王琦03184 小时前
Linux的管理程序
linux·运维·服务器
IT大白鼠5 小时前
ntfy服务器告警推送系统完整实现方案
运维·服务器·ntfy
名字还没想好☜5 小时前
Kubernetes NetworkPolicy 实战:默认全通的坑与用标签做零信任隔离
运维·云原生·容器·kubernetes·networkpolicy
SakitamaX5 小时前
高可用集群KEEPALIVED
linux·运维·服务器·keepalived
Eloudy5 小时前
给 Linux 加新硬盘的挂载命令
linux·运维·服务器
三言老师5 小时前
ss高效查看网络连接端口实操
linux·运维·服务器·网络