轻松几步搞定SSH连接Git配置
生活随笔
收集整理的這篇文章主要介紹了
轻松几步搞定SSH连接Git配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
轉載自?輕松幾步搞定SSH連接Git配置
如果使用ssh的方式管理,需要配置ssh key.
1、打開git bash命令窗口
2、生成ssh key
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"your_email@example.com為github上你注冊的email地址。
如下面完整創建過程:
$ ssh-keygen -t rsa -b 4096 -C "test@qq.com"Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa. Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub. The key fingerprint is: SHA256:chS9dRlB6Ee+E6/Ob9plXh5HXgDhhOk6mpST+oqrCxA test@qq.comThe key's randomart image is: +---[RSA 4096]----+ | ? ? ? ?.. o++++ | | ? ? ? ? .+oo.+ ?| |E ? ? ? .. +.+. ?| | . ? ? . ?o . +. | |. ? ? .oS. ? . +o| |. ? ? =oo ? ? ooo| |. ? ?o + . ? ? +*| |. ?.. o ? ? ?..=*| |ooo..o. ? ? ?.++=| +----[SHA256]-----+
上面默認生成在用戶主目錄的.ssh目錄下,可以自己輸入自定義位置。
3、把ssh key添加到github
復制文件c/Users/Administrator/.ssh/id_rsa.pub內容,把key添加到:github > settings > SSH and GPG keys > New SSH key > 粘貼保存。
4、測試SSH連接
$ ssh -T git@github.com如下面表示已經連接成功:
$ ssh -T git@github.com Hi Javastack! You've successfully authenticated, but GitHub does not provide shell access.現在你可以通過SSH方式來clone及提交代碼了。
更多詳細配置請參考官方配置:
https://help.github.com/articles/connecting-to-github-with-ssh/創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎
總結
以上是生活随笔為你收集整理的轻松几步搞定SSH连接Git配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电脑配置基本知识及其自我介绍?
- 下一篇: Git安装及配置5分钟快速教程