windows下如何down git上的程式碼
阿新 • • 發佈:2018-12-12
1.Windows下生成.ssh檔案,若已經生成,則找到該檔案;
開啟git 命令列:ls -al ~/.ssh 來檢視是否有ssh key存在;
檢查/.ssh目錄來檢視是否存在公開的ssh key
一般而言,公開的ssh key的檔名為以下幾種:
- id_dsa.pub
- id_ecdsa.pub
- id_ed25519.pub
- id_rsa.pub
建立一個 SSH key :
在你檢查過存在的ssh key後,你可以新建一個ssh key: 開啟Git Bash 輸入這一串:“ ” 中的內容為公司分配的個人郵箱/自己的郵箱
$ ssh-keygen -t rsa -C " [email protected]"
生成了之後去你本地c://使用者名稱//.ssh資料夾下找有兩個檔案,把pub打開復制到github上;
2.測試一下該SSH key
ssh -T [email protected]
[email protected] MINGW64 ~
$ ls -al ~/.ssh
ls: cannot access '/c/Users/hasee/.ssh': No such file or directory
[email protected] MINGW64 ~
$ ssh-keygen -t rsa -C "[email protected] "
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/hasee/.ssh/id_rsa):
Created directory '/c/Users/hasee/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/hasee/.ssh/id_rsa.
Your public key has been saved in /c/Users/hasee/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:5I/cwhM6Tps4xmgkAislERFhy1xqH0OsSWr5DrXYS9w [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|=*.o |
|=.=. |
|oB+o . |
|==o.o o |
|o+*.o S |
|=o.* E + = |
|oo+o. + * o |
| oo++ + o |
| . ...+ |
+----[SHA256]-----+