나는 레일 튜토리얼에 마이클 하틀의 루비의 제 2 장에서 오전과 내가 입력 한 명령 줄에 다음과 같은 : 나는 그 Github에서의 존재를 언급하기 전에 치명적인 오류가 발생했습니다 것을보고Git이 잘못된 저장소에 커밋하는 이유는 무엇입니까?
$ git init
$ git add .
$ git commit -m "Initial commit"
$ git remote add github https://github.com/themaktravels/demo_app.git
fatal: remote github already exists.
$ git push -u github master
Username:
Password:
To https://github.com/themaktravels/first_app.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/themaktravels/first_app.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
,하지만 난이 생각 이전에 Git에서 다른 저장소에 커밋했기 때문에 괜찮 았습니다. 내가 $ git push -u Github master
일 때 그 결과는 새로 생성 된 저장소 (demo_app.git)가 아닌 잘못된 저장소 (first_app.git)에서 커밋을 시도하고 있다는 것을 알게되었습니다. 왜 이런 일이 일어나는 걸까요?
$ cd ~/rails_projects
$ rails new demo_app
$ cd demo_app
을 한 후 내 보석 파일을 편집하고 모든 것이 잘 보였다 :
커밋하기 전에, 나는 다음에 입력. 이 자식 문제가 생길 때까지. 어떤 제안? 고맙습니다. 역사를 잃고에서 당신을 방지하기 위해
필자는'$ git remote -v'를 시도했으며 demo_app.git에 github이있는 것처럼 보입니다 ... 출력은 다음과 같습니다 :'github [email protected] : themaktravels/demo_app.git (fetch)''github \t [email protected] : themaktravels/demo_app.git (push)''출처 \t [email protected] : (가져 오기)''출처 [email protected] : (push)'. 즉, 새 저장소를 만들기 전에 "github"의 이름을 다른 것으로 변경해야합니까? – LearningHowToCode