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

4651 단어 git
로컬에서 프로젝트를 작성하려면 git add * 및 git commit -m'XXX'
그리고github에 창고를 새로 만들고 연결을 준비한 후 코드를 원격 창고로 전송합니다
git push에서 오류가 발생했습니다.
(venv) [willie@localhost DJangoHotel_Python]$ git remote add origin [email protected]:williezh/hotelbooksystem.git
(venv) [willie@localhost DJangoHotel_Python]$ git remote -v

origin [email protected]:williezh/hotelbooksystem.git (fetch)
origin [email protected]:williezh/hotelbooksystem.git (push)
(venv) [willie@localhost 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.
여러 블로그를 살펴보고 테스트한 결과 키 구성에 문제가 있었습니다.
참조:http://blog.csdn.net/hhhccckkk/article/details/50737077
Permission 문제를 해결하고 나서 hint 문제가 생겼어요.
(venv) [willie@localhost 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) [willie@localhost 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
If you wish to set tracking information for this branch you can do so with:
    git branch --set-upstream-to=origin/master
(venv) [willie@localhost DJangoHotel_Python]$ git pull origin master
From github.com:williezh/hotelbooksystem
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories
해결 방법 참조:http://blog.csdn.net/byoooy/article/details/52263404
(venv) [willie@localhost 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) [willie@localhost DJangoHotel_Python]$ rm -f .gitignore
(venv) [willie@localhost 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) [willie@localhost DJangoHotel_Python]$ cat README.md
(venv) [willie@localhost DJangoHotel_Python]$ vim README.md
(venv) [willie@localhost DJangoHotel_Python]$ git add *
(venv) [willie@localhost DJangoHotel_Python]$ git commit -m 'fix the readme.md'
(venv) [willie@localhost DJangoHotel_Python]$ git push -u origin master

업로드할 수 있지만 가상 환경을 포함하는 폴더venv 때문에 파일이 너무 크고 업로드가 느립니다
과감하게 ctrl+c로 업로드를 끊고 다음:
(venv) [willie@localhost DJangoHotel_Python]$ deactivate
 [willie@localhost DJangoHotel_Python]$ cd ..
[willie@localhost projects]$ git clone https://github.com/williezh/hotelbooksystem
[willie@localhost projects]$ cd hotelbooksystem/

DJango Hotel을...Python 폴더에서venv를 제외한 모든 보이는 파일과 폴더를 현재 디렉터리로 복사 (수동 조작)
[willie@localhost hotelbooksystem]$ git add *
[willie@localhost hotelbooksystem]$ git commit -m 'version 1.0'
[willie@localhost hotelbooksystem]$ git push -u origin master

사용자 이름과 비밀번호를 입력하여 업로드하였습니다!
총괄: 로컬 창고,git init 이후에 편집해야 합니다.git/info/exclude 파일입니다. 가상 환경과 ~ 파일을 무시합니다. git push에서 파일이 너무 크지 않도록 합니다.

좋은 웹페이지 즐겨찾기