//设置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:UsersAdministrator.ssh 目录下 id_rsa和id_rsa.pub 两个文件
拷贝id_rsa.pub文件内容到 git 服务器上就可以了