//設置user.name和email 提交到git以後會顯示用戶名(在隨意一個目錄打開git-bash執行就行)
Administrator@DESKTOP-BP3H0HS MINGW64 /d/midou (master) $ git config --global user.name "liuchao" Administrator@DESKTOP-BP3H0HS MINGW64 /d/midou (master) $ git config --global user.email "liuchao102@163.com"
//生成祕鑰 Administrator@DESKTOP-BP3H0HS MINGW64 /d/midou (master) $ ssh-keygen -t rsa -C "liuchao102@163.com"
Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): /c/Users/Administrator/.ssh/id_rsa already exists. Overwrite (y/n)? y 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:N20m0PnwfNSZZaCOvp8gW8Fac49kIQo1fUMz+490AO8 「liuchao102@163.com The key's randomart image is: +---[RSA 2048]----+ | o. .= ..o| | . o..oB o+| | . . =.+.+o.| | . + X = . | | S X % E .| | = @ = + | | o + . o .| | + o . | | . ..o | +----[SHA256]-----+ Administrator@DESKTOP-BP3H0HS MINGW64 /d/midou (master) $
生成完祕鑰以後會在 C:\Users\Administrator\.ssh 目錄下 id_rsa和id_rsa.pub 兩個文件git
拷貝id_rsa.pub文件內容到 git 服務器上就能夠了bash