Git常見問題

以下錯誤都是樓主自己在試驗時碰到的一些問題

  1. 錯誤一 Permission denied (publickey)

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

原因: Git找不到生成的祕鑰,如果沒有生成就重新生成,若生成了就將祕鑰添加一下,用如下命令:

ssh-add ~/.ssh/github
因爲樓主生成祕鑰時用的是自定義的名稱(github),如果你是默認配置,直接用ssh-add ~/.ssh/id_rsa即可

  1. 錯誤二 Could not open a connection to your authentication agent.
    使用以下指令即可解決

ssh-agent bash

  1. 錯誤三

樓主在使用git push -u origin 指令時提示以下信息
fatal: The current branch master has no upstream branch.To push the current branch and set the remote as upstream, use
git push --set-upstream origin master

原因: 因爲樓主在github官網上新建完倉庫後,並不會生成分支

這裏只需要使用git push -u origin master指令即可解決

發佈了27 篇原創文章 · 獲贊 0 · 訪問量 679
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章