0


linux配置git账号密码

在这里插入图片描述

HTTP/HTTPS

Linux

在Linux环境下使用http/https协议clone/pull GitLab仓库的代码遇到这个问题。以下解决方案也适合GitHub或其他仓库如码云,coding。

解决方案:

  1. 在home目录下创建.git-credentials文件vim .git-credentials,输入形如https://{username}:{password}@github.com的配置文本:http://root:[email protected]/8090 若有多个,一行一个,:wq保存退出
  2. 执行命令:git config --global credential.helper store
  3. 执行命令:cat ~/.gitconfig,存在如下内容即代表成功:[credential]helper = store12

注:使用HTTP/HTTPS协议clone代码时,不需要配置SSH key。

注:所谓的使用HTTP/HTTPS协议,打开

.git/config

文件,url协议是http/(s):

[remote "origin"]
    url = http://git.aaa.com/aaa/aaa.git
    fetch = +refs/heads/*:refs/remotes/origin/*

参考:
https://blog.csdn.net/lonelymanontheway/article/details/118107326
https://blog.csdn.net/tsq292978891/article/details/89316612

标签: linux git 运维

本文转载自: https://blog.csdn.net/weixin_54227557/article/details/131443477
版权归原作者 irrationality 所有, 如有侵权,请联系我们删除。

“linux配置git账号密码”的评论:

还没有评论