想把本地的git庫上傳到github上。github已經新建了一個public倉庫,利用網站的命令
git Bash報錯:does not appear to be a git repository Could not read from remote respository
網上搜索了一下,說是github的公鑰沒有生成,但是網上搜索到的方法不能解決我的問題,去官網自己看,有生成公鑰的方法
鏈接:https://help.github.com/en/articles/connecting-to-github-with-ssh 照着文檔操作就可以了
1、檢查是否存在SSH key:
$ ls -al ~/.ssh
類型如下:pub是公鑰。
- id_dsa.pub
- id_ecdsa.pub
- id_ed25519.pub
- id_rsa.pub
2、Generating a new SSH key :email是你注冊github的郵箱
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
3、出現下面信息時,回車就好:
Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
4、重新打開git Bash
再次檢查SSH key
5、cat id_rsa.pub 打開秘鑰文檔復制里面的公鑰添加到 setting-SSH and GPG keys-new SSH key里 重新登錄github就好