想下载github上的源码,但提示没有公钥
# git clone git@github.com:cloudera/hue.git
Cloning into 'hue'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
此时!!!需要有一个github上的账号(没有需要注册,很简单)
官网:https://github.com/
在命令行创建公密钥,一路回车即可
ssh-keygen -t rsa
cat /root/.ssh/id_rsa.pub #公钥,将以下内容加入 github 的 key
注册完成登录,鼠标点击右上角的头像的下三角图形,界面选择Settings --> SSH and GPG keys -->new SSH keys;
Title填入:自定义名称 和 Key填入:你虚拟机上的 /root/.ssh/id_rsa.pub 的公钥内容;
保存即可
重新在虚拟机上输入,即可正常下载
# git clone git@github.com:cloudera/hue.git
亲测有效!!!
谢谢