linux 配置git/gitlab
阿新 • • 發佈:2018-11-10
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 ”[email protected] .com"
#檢視git config 配置資訊
git config --global --list
#git 公鑰私鑰
ssh-keygen -t rsa -C “[email protected].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對映