1. 程式人生 > >git push -u origin master 出錯 \Permission denied (publickey). fatal: Could not read from remote repo

git push -u origin master 出錯 \Permission denied (publickey). fatal: Could not read from remote repo

在本地寫好專案,一路git add * 和 git commit -m 'XXX'

然後在github上新建倉庫,準備關聯後,把程式碼推送至遠端倉庫

在git push 時就出錯了:

(venv) [[email protected] DJangoHotel_Python]$ git remote add origin [email protected]:williezh/hotelbooksystem.git
(venv) [[email protected] DJangoHotel_Python]$ git remote -v

[email protected]

:williezh/hotelbooksystem.git (fetch)

[email protected]:williezh/hotelbooksystem.git (push)

(venv) [[email protected] DJangoHotel_Python]$ 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.

查看了好多部落格,並試驗後,發現是金鑰配置的問題:

解決了Permission的問題後,又出現了hint的問題

(venv) [[email protected] DJangoHotel_Python]$ git push -u origin master
To github.com:williezh/hotelbooksystem.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '[email protected]:williezh/hotelbooksystem.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
(venv) [
[email protected]
DJangoHotel_Python]$ git pull
warning: no common commits
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From github.com:williezh/hotelbooksystem
 * [new branch]      master     -> origin/master
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.


    git pull <remote> <branch>


If you wish to set tracking information for this branch you can do so with:


    git branch --set-upstream-to=origin/<branch> master
(venv) [[email protected] DJangoHotel_Python]$ git pull origin master
From github.com:williezh/hotelbooksystem
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories
(venv) [[email protected] DJangoHotel_Python]$ git pull origin master --allow-unrelated-histories
From github.com:williezh/hotelbooksystem
 * branch            master     -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
.gitignore
Please move or remove them before you merge.
Aborting
(venv) [[email protected] DJangoHotel_Python]$ rm -f .gitignore
(venv) [[email protected] DJangoHotel_Python]$ git pull origin master --allow-unrelated-histories

From github.com:williezh/hotelbooksystem
 * branch            master     -> FETCH_HEAD
Auto-merging README.md
CONFLICT (add/add): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.

(venv) [[email protected] DJangoHotel_Python]$ cat README.md
(venv) [[email protected] DJangoHotel_Python]$ vim README.md
(venv) [[email protected] DJangoHotel_Python]$ git add *
(venv) [[email protected] DJangoHotel_Python]$ git commit -m 'fix the readme.md'
(venv) [[email protected] DJangoHotel_Python]$ git push -u origin master

可以上傳了,但是因為包含了虛擬環境的資料夾venv,導致檔案太大,上傳很慢

果斷ctrl+c打斷上傳,然後:

(venv) [[email protected] DJangoHotel_Python]$ deactivate
 [[email protected] DJangoHotel_Python]$ cd ..
[[email protected] projects]$ git clone https://github.com/williezh/hotelbooksystem
[[email protected] projects]$ cd hotelbooksystem/

把DJangoHotel_Python資料夾裡,除venv外的所有可見檔案及資料夾,複製到當前目錄(手動操作)

[[email protected] hotelbooksystem]$ git add *
[[email protected] hotelbooksystem]$ git commit -m 'version 1.0'
[[email protected] hotelbooksystem]$ git push -u origin master

輸入使用者名稱和密碼,成功上傳!

總結:本地倉庫,在git init之後,就應該編輯.git/info/exclude檔案,忽略掉虛擬環境和~檔案,以免git push的時候檔案太大。

相關推薦

git push -u origin master 出錯 \Permission denied (publickey). fatal: Could not read from remote repo

在本地寫好專案,一路git add * 和 git commit -m 'XXX' 然後在github上新建倉庫,準備關聯後,把程式碼推送至遠端倉庫 在git push 時就出錯了: (venv) [[email protected] DJangoHotel_P

git Permission denied (publickey). fatal: Could not read from remote repository.

問題描述: 最近剛剛學爬蟲,從學長的git上clone到伺服器的時候 出現的這個問題,問題不大吧,估計以後還會遇到。 問題很簡單,就是沒有祕鑰,顯然github不知道你是誰,然後禁止你拉取程式碼。 原理:本地生成祕鑰,然後新增到GitHub裡面 DONE 解決方法: 1.本地生成祕鑰:

00 git clone 提示Permission denied (publickey). fatal: Could not read from remote repository.

執行git clone命令為:git clone  xxxxx的時候提示 Permissiondenied (publickey).   fatal:Could not read from remote repository.   Pleasemake sure you have

Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights

please sudo _id ima upd cal .com root pin 第一次提交遇到這樣的情況,怎麽回事呢,我在github上提交了ssh key 的啊。 排查先看看能不能解析, 1.先 ping https://github.com 把ip添加到 ho

Permission denied (publickey). fatal: Could not read from remote repository.

ech IT git 生成 兩個文件 tin 一個 繼續 con 執行語句git push -u origin master的時候出現下面的錯誤 Permission denied (publickey).fatal: Could not read from remo

Permission denied (publickey) fatal:Could not read from remote repository

安裝了TortoiseGit之後,Eclipse能夠克隆提交操作,但是通過資料夾的方式clone卻總是報Permission denied (publickey)錯誤 ,網上找各種資料都沒有解決。 報錯資訊如下圖: 後面發現TortoiseGit Git clone時 “

【github常見操作和常見錯誤】錯誤提示:Permission denied (publickey). fatal: Could not read from remote repository.

(1)首先新建 SSH key,在git shell(或者git bash等命令視窗),注意大小寫: $ ssh-keygen -t rsa -C “郵箱名” 然後會出現: Generating public/private rsa key

Git push Access denied exec request failed on channel 0 fatal: Could not read from remote repository

Git push 和pull時沒有許可權首先去碼雲/git下 檢視是不新增 公鑰 如果沒有,把開發環境中的.ssh/id_pub進行貼上 至 碼雲那邊的git公鑰,再重新pull即可其次可以去專案中的 .Git資料夾下 config下 進行檢視url是否和遠端倉庫的的url一

git push時報錯fatal: Could not read from remote repository.

將本地庫的所有內容推送到遠端庫,輸入命令: git bash報錯: 輸入命令: git bash 輸出: 對比github 兩處地址不一樣。 解決方法: 輸入以下兩個命令列: $ git remote set-url origin ht

git: fatal: Could not read from remote repository

nag fatal choose native tell ack arch manage fat This is probably an Intellij problem. Your key are managed natively by ssh, and Intellij

git提示錯誤關於錯誤:ssh: Could not resolve hostname github.com: Name or service not known.fatal: Could not read from remote repository.

eight 無法讀取 主機名 github上 錯誤2 winsock nal file drive 關於 Git 使用中出現的錯誤 饑人谷_楠柒 關註 2016.11.02 15:33* 字數 746 閱讀 3607評論 5喜歡 10贊賞 1 關

git常見的一些錯誤:fatal: Could not read from remote repository. fatal: Not a git repository (or any of the

錯誤一:fatal: Not a git repository (or any of the parent directories): .git 此錯誤是因為你當前所在的資料夾還沒有git成本地倉庫,確保你是在作為本地倉庫的資料夾下,然後使用:git init   錯誤二:

git pull時報錯fatal: Could not read from remote repository.

git pull 時 報錯如下資訊:ssh: Could not resolve hostname https: nodename nor servname provided, or not know

Push failed: Failed with error: fatal: Could not read from remote repository.

在碼雲賬號上把專案轉移到組織後報的異常Push failed: Failed with error: fatal: Could not read from remote repository或者異常fatal: remote origin already exists以上都市

Push failed. Failed with error: fatal: Could not read from remote repository.

在往github 倉庫提交的時候出現以下錯誤。 Failed with error: fatal: Could not read from remote repository.      此原因是因為ssh公鑰有問題,因為之前電腦是以前的同事用著,我直接就改為自己的賬號

On branch master nothing to commit, working tree clean ERROR: Repository not found. fatal: Could not read from remote repository.

solution not sys lang color node 報錯 mini have 將gitbash部署hexo到github:hexo deploy 報以下錯誤: [email protected] MINGW64 /Hexo $ hex

$ git push -u origin master 推送到遠端庫出錯

1、錯誤描述: 出錯場景描述: github上建立遠端倉庫的時候選擇新增README.md檔案, git bash連線遠端庫,然後執行push操作,出現下面的問題 $ git push -u origin master To github.com:XXXX/Des

git push origingit push -u origin master的區別

2.0 matching 命令 參數 主機 主機名 bsp 如果 方法 $ git push origin 上面命令表示,將當前分支推送到origin主機的對應分支。 如果當前分支只有一個追蹤分支,那麽主機名都可以省略。 $ git push 如果當前分支與多個主機存在

$ git push -u origin master

問題描述: remote: Permission to name/project-name.git denied to your-name. fatal: unable to access 'https://github.com/author-name/project-name.git/': The

git "Could not read from remote repository.Please make sure you have the correct access rights."解決方案

tpc 覆蓋 com 設置 _id pub ould ack ref 我們在使用git clone 或其他命令的時候,有時候會遇到這類問題,如圖: fatal: Could not read from remote repository. Please make s