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插件 ![](https://i-blog.csdnimg.cn/direct/a22a26210b894b13893370d0c71d8ef4.png) 应用以上设置后,再次克隆代码,即可使用账号密码进行登录。 ![](https://i-blog.csdnimg.cn/direct/851ce3f8787a42a1ba34d7285ce9175a.png)

相关推荐
invicinble8 小时前
对linux形成认识
linux·运维·服务器
小Pawn爷8 小时前
14.VMmare安装ubuntu
linux·运维·ubuntu
技术路上的探险家8 小时前
8 卡 V100 服务器:基于 vLLM 的 Qwen 大模型高效部署实战
运维·服务器·语言模型
有谁看见我的剑了?8 小时前
介绍一款 测试 DNS解析成功率的网站
运维
半桔9 小时前
【IO多路转接】高并发服务器实战:Reactor 框架与 Epoll 机制的封装与设计逻辑
linux·运维·服务器·c++·io
HABuo9 小时前
【linux文件系统】磁盘结构&文件系统详谈
linux·运维·服务器·c语言·c++·ubuntu·centos
Howrun7779 小时前
关于Linux服务器的协作问题
linux·运维·服务器
yunfuuwqi11 小时前
OpenClaw✅真·喂饭级教程:2026年OpenClaw(原Moltbot)一键部署+接入飞书最佳实践
运维·服务器·网络·人工智能·飞书·京东云
迎仔11 小时前
C-算力中心网络隔离实施方法:怎么搞?
运维·网络
代码游侠11 小时前
C语言核心概念复习——网络协议与TCP/IP
linux·运维·服务器·网络·算法