IDEA关联gitlab

1、下载安装 Git;

2、在 Git Bash 工具中创建用户名和邮箱(邮箱必须与gitlab账号的邮箱一致):

git config --global user.name "YourName"
git config --global user.email 78******52@qq.com

3、生成密钥:

  • 首先查看是否已经有密钥(看用户主目录下是否有 .ssh 文件),如果有则备份后删除;
  • ssh-keygen -t rsa -C "78******52@qq.com"

    注意:按 3 下回车,密码为空;另外,生成密钥的邮箱必须与前面的邮箱一致。

  • .ssh 目录下得到两个文件:id_rsa(私钥)和 id_rsa.pub(公钥)。

4、在 gitlab 中输入公钥:

  • 复制 id_rsa.pub 文件中的内容;
  • 在 gitlab 的个人账户配置页面的 SSH Keys 模块中粘贴公钥字符码;

5、关联 IDEA

  • 打开 IDEA 配置页面 Settings 》Version Control 》Git 中,Path to Git executable 路径要匹配 *Gitcmdgit.exe 的路径;
  • SSH executable 选择 Native,然后 Apply 即可。

6、添加远程仓库:选择 IDEA 工具栏 VCS 》Git 》Remotes,仓库名默认为 origin,仓库 url 填写 gitlab 远程仓库的 SSH 路径,例如:

   git@gitlab.c*****y.com:r****t/W********f.git 
7、finish
 
8. 由于git版本问题,如果以上配置后还是没用,在git bash中添加下列指令:git config --global http.sslVerify false
原文地址:https://www.cnblogs.com/unique1319/p/7114982.html