linux 配置git/gitlab

Error:
ssh: connect to host ***: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.
Answer1:配置公钥

#设置git身份的名字和邮箱
git config --global user.name "yourname"
git config --global user.email ”your@email.com"
#查看git config 配置信息
git config --global  --list
#git 公钥私钥
ssh-keygen -t rsa -C “your@email.com”
"""
一路回车
……
Your public key has been saved in /home/***/.ssh/id_rsa.pub.
……
打开git/gitlab 个人中心 - setting - SSH Keys
复制 /home/***/.ssh/id_rsa.pub 文件内容 到key
add SHH key
"""

Answer2:配置host
windows host 文件地址:C:\Windows\System32\drivers\etc
linux:/etc/hosts
在文件结尾添加 ip映射

猜你喜欢

转载自blog.csdn.net/weixin_33127753/article/details/83149642