我在计算机上全新安装了Ubuntu 16.04。现在,我想在计算机上使用现有的ssh密钥,以便可以将GitHub与以前的活动一起使用。
我该如何设置?
如果您有ssh密钥的副本(例如,在USB记忆棒上),则只需将密钥文件复制到~/.ssh/
目录中即可。
例如,
cp /path/to/my/key/id_rsa ~/.ssh/id_rsa
cp /path/to/my/key/id_rsa.pub ~/.ssh/id_rsa.pub
# change permissions on file
sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub
# start the ssh-agent in the background
eval $(ssh-agent -s)
# make ssh agent to actually use copied key
ssh-add ~/.ssh/id_rsa
否则,您将需要创建一个新帐户并将其添加到您的GitHub帐户https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/。在使用时,请确保从GitHub上删除旧密钥。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句