前兩天自己寫了一個食品商城的專案,提交至GitHub遇到了一個小小的絆腳石。
複製程式碼
看一眼error
git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.複製程式碼
每次初始化的時候都是正常運作的,一到push出現了問題
簡單看了下錯誤,發現問題在於前幾天換了個系統,Git重灌之後沒有配置ssh,重頭到尾搞一遍下載ssh-keygen
一路回車即可,去找生成的keygen檔案 C:\使用者\你的使用者名稱\.ssh\id_rsa.pub 把內容全部複製
回到GitHub
1.設定
2. 找到ssh
3.建立
4.完成 (tittle為keygen)
如果還存在問題考慮一下,賬戶名和郵箱是否正確.
重新設定一下賬戶名和密碼
$ git config --global user.name "賬戶名"
$ git config --global user.email "郵箱"
完成
是時候起飛上傳程式碼了