1. 程式人生 > >本地git倉庫連線到GitHub遠端倉庫遇到[email protected]<

本地git倉庫連線到GitHub遠端倉庫遇到[email protected]<

學習git的時候免不了會遇到很多坑,這裡記錄其中的一個。

當我高高興興的建立了一個本地倉庫,並且想把它push到github遠端倉庫上時,我按照網上的教程先輸入了:

 git remote add origin [email protected]:yourname/xxx.git

其中yourname指的是github賬戶的名字,xxx為倉庫名。連線到遠端倉庫之後,輸入git remote -v可以看到

即表示已經成功的連線到遠端倉庫了,但是這個時候遠端倉庫還是空的,現在就要把本地倉庫的內容push到遠端去,繼續輸入:

 git push -u origin master

按照網上教程,這裡會先顯示一個warning:

The authenticity of host 'github.com (13.229.188.59)' can't be established.

RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.

Are you sure you want to continue connecting (yes/no)? 

輸入yes後會提示

Warning: Permanently added 'github.com,xx.xx.xx.xx' (RSA) to the list of known hosts.

按理說這個時候我們已經把本地的內容提交到遠端倉庫了,以後每次push應該也不會出先上述的warning了。但是!這個時候,下面緊跟著出現了一條提示:

[email protected]: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

我先是百度了一下,看了幾篇部落格,但是寫的都有點讓我雲裡霧裡(畢竟只是個git新手...),找著找著我點開了一個

StackOverflow的頁面,裡面的問題描述和我的一模一樣。我看了一下,原來是要在github網站中設定自己的ssh公鑰。於是我按照StackOverflow上的講解,設定了一下ssh公鑰,再push了一次就成功了!

首先登陸github網站,點選右上角的這個位置

然後點選下拉標籤中的Settings選項

點選SSH and GPG keys,點選右側的New SSH key,在彈出的頁面中輸入本機的SSH公鑰進行新增即可。

本機ssh公鑰生成以及檢視方法為:

首先在終端輸入 ssh-keygen 

然後輸入 vim ~/.ssh/id_rsa.pub 檢視公鑰

將vim下的ssh公鑰拷貝出來貼上在下面的Key中並隨便輸入一個喜歡的Title即可新增。

果然遇到問題還是上外文網站解決起來比較快...

相關推薦

本地git倉庫連線GitHub遠端倉庫遇到<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6f08061b2f08061b071a0d410c0002">[email&#160;protected]<

學習git的時候免不了會遇到很多坑,這裡記錄其中的一個。 當我高高興興的建立了一個本地倉庫,並且想把它push到github遠端倉庫上時,我按照網上的教程先輸入了:  git remote add origin [email protected]:yournam

<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c384aab7838c9080">[email&#160;protected]a>伺服器和Xcode的git管理工具簡單使用

OSChina提供的git伺服器,每一個賬號可建立1000個專案,不論公有或私有專案,程式碼託管服務永久免費。而且由於是國內的網站和伺服器,又是中文的,相對於國外的而言,訪問比較通暢,操作起來也容易上手。 本文介紹如何使用OSChina的g

git | git clone <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4c2b25380c2b253824392e622f2321">[email&#160;protected]a>:LL

在CMD中輸入git clone [email protected]:LLK/scratch-gui.git下載scratch-gui.git時,出現錯誤: [email protected]:Permission denied(publickey).

mac操作git <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7d1a14093d1a14091818531e1210">[email&#160;protected]a>: Permission

官方解決文件:  http://git.mydoc.io/?t=154712 1)、重新生成ssh  ssh-keygen -t rsa -C “[email protected]”  2)、檢視你的 public key  cat ~/.ssh

Github賬號push時提示<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2c4b45586c4b455844594e024f4341">[email&#160;protected]a>: P

1.背景 設定了多個github賬號,配置好了~/.ssh/config 檔案,如下: # Host為別名,可自己任意定義。 # 然後用ssh -T [email protected]可測試,如ssh -T [email protected] # G

MacOS下git clone <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8dfd1ccf8dfd1ccd0cdda96dbd7d5">[email&#160;protected]a>: P

MacOS下git clone [email protected]: Permission denied (publickey)錯誤及解決方式 前言 錯誤訊息 解決辦法 改用git當使用者名稱 檢查是否有使用key

github解決hexo d命令出錯error: 推送一些引用到 '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7b0bea397b0bea3bfa2b5f9b4b8ba">[email&

error: 推送一些引用到 '[email protected]:xxxx.github.io.git' 失敗 FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/tro

Git在windows下的安裝和使用<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="52151b06121d0111">[email&#160;protected]a>

Git for Windows v2.7.0 Release Notes Latest update: January 5th 2016 Introduction These release notes describe issues specific to the Git for Windows rele

mac/linux/centos通過 ssh <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="21534e4e5561">[email&#160;protected]a>方式連線如何上傳檔案都阿里雲

目錄1、mac上傳檔案到Linux伺服器scp 檔名 使用者名稱@伺服器ip:目標路徑如:scp /Users/test/testFile [email protected]:/test/2、mac上傳資料夾到Linux伺服器,與上傳檔案相比多加了-rscp -r

git上傳到一半最後報error:failed to push some refs to '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a4c3cdd0e4c3cdd0ccd1c68ac7cbc9"

今天上傳程式碼到git上,上傳一半卡住了,過了一會兒就報: Counting objects: 52, done. Delta compression using up to 2 threads. Compressing objects: 100% (48/48), don

git push 時報錯 error: failed to push some refs to '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a3c4cad7e3dbdbdbdbdbdb">[ema

原因:這是一個新建的一個倉庫,提交到github時,沒有 pull下來,導致 github中的README.md檔案不在原生代碼目錄中 $ git push -u origin master To github.com:Houttuyniae/notes.git ! [

Git本地倉庫Github遠端倉庫關聯

1.從遠端克隆一份到本地:git clone Git支援HTTPS和SSH協議,SSH速度更快 $ git clone [email protected]:zkk/xx.git 2.本地庫關聯遠端庫,在本地倉庫目錄執行命令: $ git remote add origin

本地專案提交到Github遠端倉庫專案分支的全過程——賊詳細

個人學習,指正可以,不喜勿噴!!! 專案檔案(不是真實專案,僅演示): $ ll test_project/ total 1 -rw-r--r-- 1 Y 197121 24 九月 29 20:39 READEM 1.本地初始化 git init 進入本地專案,初始

SublimeText3之——配置Git並使用GitHub遠端倉庫

P.S. 配置好以後,上傳步驟: add → commit → 彈出註釋檔案 → push → 控制檯顯示To github.com 一、Git安裝 到Git的 官網 上去下載 相應環境 的Git安裝檔案 (我的是win10,安裝到C:\0

使用Git命令從Github遠端倉庫更新專案

如果說其他的開發人員往Github專案中修改了程式碼,我要在他們的餓基礎上繼續進行開發,那麼應該怎樣才能把Github的程式碼同步下來呢,注意此時並不是要重新git init.在本機建立一個新的倉庫了。其實此時本機的程式碼倉庫和遠端伺服器已經保持了一個連線,我們只要把程式

github學習--本地倉庫同步github遠端倉庫出現的問題

在使用git push -u origin master命令將本地的倉庫和遠端倉庫進行同步時出現了以下錯誤: $ git push -u origin master To github.com:runla/MainPageDemo.git  ! [rejected]  

Git本地倉庫連線Github/GitLab遠端倉庫

重點放在前面 上傳的Github/GitLab賬戶郵箱一定要和本地配置的郵箱相同,也就是說如果郵箱不相同,每次連線不同的Github/GitLab賬戶時,本地需要重新配置郵箱,但是ssh不用重新生成,測試過了。GitLab連線和Github相同,所以會一邊就好了

基於SSH協議clone GitHub遠端倉庫本地-git

輸入框 setting 生成 ready 可能 取代 初學 into etc 經常逛 GitHub 的可能都知道,在 clone 遠端倉庫的時候,會有兩個選項,如下圖: 首先我們來說明一下兩種方式的區別。 使用 HTTPS url 克隆對初學者來說會比較方便,復制HTT

Git學習第(二)篇:Git建立本地倉庫並與GitHub遠端倉庫關聯

本文基於Windows系統進行相關的配置。 1、建立本地Git倉庫 上一篇文章Git學習第(一)篇:Git下載與安裝中已經介紹了Git下載和安裝的方法,並按照裡面的步驟完成了安裝,接下來需要建立本地倉庫 第一步,找到需要建立Git倉庫的專案資料夾,比如我的專案為html5,