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)

相关推荐
TH_16 小时前
35、AI自动化技术与职业变革探讨
运维·人工智能·自动化
yuhaiqun19897 小时前
学服务器训练AI模型:5步路径助力高效入门
运维·服务器·人工智能·笔记·机器学习·ai
huaweichenai8 小时前
docker部署kkFileView实现文件预览功能
运维·docker·容器
以太浮标8 小时前
华为eNSP模拟器综合实验之-BFD联动配置解析
运维·网络·华为·信息与通信
工程师老罗8 小时前
龙芯2k0300 PMON取消Linux自启动
linux·运维·服务器
千百元8 小时前
centos如何删除恶心定时任务
linux·运维·centos
skywalk81639 小时前
网站证书自动续订失败的问题解决,原来是续订指令certbot renew出错,导致crontab定时任务续订失败
运维·服务器·证书·certbot
额呃呃9 小时前
游戏服务器和一般高性能服务器的区别
运维·服务器·游戏
2501_906150569 小时前
开源问卷平台DWSurvey开发配置记录
运维·开源·jenkins
gaize12139 小时前
服务器分类及区别划分!多样化服务器用途体系架构及层次分类
运维·服务器·架构