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

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

相关推荐
Decay__1 小时前
PostgreSQL 性能调优方法论 —— pg_stat_statements、EXPLAIN ANALYZE、瓶颈定位流程与参数基线
运维·数据库·sql·postgresql
stormsha7 小时前
中文路径让 MySQL 起不来:Failed to find valid data directory 与 Illegal byte sequence
运维·数据库·mysql
stormsha7 小时前
MySQL 报 `data directory has files in it`:初始化失败一次,之后就永久起不来
运维·数据库·mysql
沙老师12 小时前
Linux Purification Plan - More Modification
linux·运维·服务器
Decay__13 小时前
PostgreSQL 高可用与容灾架构 —— 流复制、Patroni、Keepalived+VIP、读写分离与两地三中心
运维·数据库·sql·postgresql
tz5251 天前
Superpowers 游戏开发实战应用场景大纲
linux·运维·服务器
倔强的石头_1 天前
Linux 电脑也能被 UU 远程连进去了:Linux PC 端内测上手,主控和被控我都试了
运维
Decay__1 天前
PostgreSQL WAL 归档与时间点恢复 —— WAL 连续归档、recovery_target 时点恢复与 pg_rewind
运维·数据库·sql·postgresql
Decay__1 天前
PostgreSQL 索引与 SQL 优化 —— B-tree、GiST、GIN、BRIN、执行计划与索引设计实战
运维·数据库·sql·postgresql
JWIPC1 天前
MyClaw 3.0 自动化数据采集实战指南
linux·运维·笔记·科技·深度学习·物联网·自动化