在使用ssh鏈接git或者osc時,須要先生成key:git
1.ssh-keygen -t rsa -C 「your email」 默認的路徑爲~/.ssh/github
2.添加密碼(能夠直接按兩次enter表示不添加密碼)ssh
3.將生成的id_rsa.pub添加到git或者osc上測試
4.使用 ssh -T git@git.oschina.net / git@git.com 測試鏈接。加密
tips:.net
在測試時,可能會出現錯誤:ip
sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).it
此時可 ssh-add ~/.ssh/id_rsa (錯誤處理參見https://help.github.com/articles/error-agent-admitted-failure-to-sign/)io