1. 程式人生 > 其它 >Git推送修改到GitHub中

Git推送修改到GitHub中

主要通過給GitHub設定SSH key的方式實現push許可權控制。

$  ssh-keygen -t rsa -C "你的郵箱"
Generating public/private rsa key pair.
//這裡指定祕鑰檔案路徑,直接回車即可
Enter file in which to save the key (/c/Users/my/.ssh/id_rsa):
Created directory '/c/Users/my/.ssh'.
//輸入登入密碼
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Your identification has been saved in 
/c/Users/my/.ssh/id_rsa Your public key has been saved in /c/Users/my/.ssh/id_rsa.pub The key fingerprint is: SHA256:[email protected] The key's randomart image is: +---[RSA 3072]----+ | .o...=o. | | .. =.. | | ..oE . | | oo O | | S B.+ B | | * O * + | | o = B X o .| | . + = X = | | o.o = | +----[SHA256]-----+

在上面路徑的id_rsa.pub中得到公鑰(全部複製)

然後進入gitHub中,找到Setting

SSH keys/ Add new
//貼上剛剛獲得的公鑰到這裡
//勾選允許寫許可權 儲存即可。