Development Tip

힘내 푸시 : "심각한 '원본'이 git 저장소로 보이지 않습니다. 치명적입니다. 원격 저장소에서 읽을 수 없습니다."

yourdevel 2020. 10. 11. 11:26
반응형

힘내 푸시 : "심각한 '원본'이 git 저장소로 보이지 않습니다. 치명적입니다. 원격 저장소에서 읽을 수 없습니다."


비슷한 질문이 이미 제기 된 것을 알고 있습니다.

하지만 제 문제는 제가 이전에 저지른 실수로 인한 것이라고 생각하므로 다른 점이 있습니다. 설명하겠습니다.

다음과 같이 모든 것이 원활하게 작동했습니다.

  • git add . 내 로컬 저장소의 모든 파일.
  • git commit -m "message here" 내 커밋에 메시지를 추가합니다.
  • git push origin master 내 파일을 GitHub에 업로드합니다.
  • git push heroku master 내 파일을 Heroku에 업로드합니다.

그러나 어느 시점 add-calendar-model에서 앱 개발의 다음 단계가 남을 경우를 대비하여 로컬로 호출되는 새 브랜치를 만들었습니다 .

... 정확히 일어난 일입니다.

그러나 여러 번의 시도에도 불구하고, master브랜치에서 로컬 저장소로 초기 코드 (예 : 새 브랜치를 생성하기 전의 코드)를 가져 오지 못했습니다 .

그래서, 난 수동으로 로컬 저장소 및 모든 파일을 삭제하기로 결정 git clonemasterGitHub의에서 분기합니다.

이렇게하면 모든 파일을 되찾았지만 이제 더 이상 원격 저장소로 푸시 할 수 없습니다.

git push origin add-calendar-model또는 을 실행하려고 할 때마다 git push origin master다음 오류가 발생합니다.

fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

지금 쯤 짐작 하셨겠지만 저는 Git과 GitHub에 익숙하지 않습니다.이 문제를 해결하는 방법에 대한 단서가 없음을 인정해야합니다.

어떤 생각?


먼저 다음을 실행 하여 오리진 이 설정 되었는지 확인하십시오.

git remote -v

프로젝트의 모든 푸시 / 페치 리모컨이 표시됩니다.

이것이 출력없이 반환되면 마지막 코드 블록으로 건너 뜁니다.

원격 이름 / 주소 확인

리모컨이 설정되어 있다는 메시지가 반환되면 리모컨의 이름이 명령에서 사용중인 리모컨과 일치하는지 확인하십시오.

$git remote -v
myOrigin ssh://git@example.com:1234/myRepo.git (fetch)
myOrigin ssh://git@example.com:1234/myRepo.git (push)

# this will fail because `origin` is not set
$git push origin master

# you need to use
$git push myOrigin master

리모컨의 이름을 바꾸거나 리모컨의 URL을 변경하려면 먼저 이전 리모컨을 제거한 다음 올바른 리모컨을 추가해야합니다.

이전 리모컨 제거

$git remote remove myOrigin

누락 된 리모컨 추가

그런 다음 적절한 리모컨을 사용하여 추가 할 수 있습니다.

$git remote add origin ssh://git@example.com:1234/myRepo.git

# this will now work as expected
$git push origin master

Matt Clark이 위에서 언급했듯이

그러나 원본이 설정되지 않았을 수 있으므로 삭제 단계를 건너 뛰고 단순히 추가를 시도하면이 문제를 해결할 수 있습니다.

git remote add origin <"clone">

"clone"은 단순히 GitHub 저장소로 이동하고 "HTTPS 복제 URL"을 복사하여 GitBash에 붙여 넣는 것입니다.


.git의 구성 파일이 올바른지 확인하십시오 ... URL을 확인하고 키에 올바른 프로토콜을 사용하고 있는지 확인하십시오 ... ProjectWorkspace / .git / config

  ~Wrong url for git@bitbucket
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = gitbucket.org:Prezyack/project-one-hello.git
    fetch = +refs/heads/*:refs/remotes/origin/*

 ~Wrong URL for SSH...
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = https://emmap1@bitbucket.org/emmap1/bitbucketspacestation.git
[branch "master"]
    remote = origin
    merge = refs/heads/master

우리는 URL을보고 있습니다 ... 예 : bitbucket의 경우 git@bitbucket.org를 기대하십시오 .... gitbucket.org 인 경우. 필요한 사항을 변경하십시오. 저장 다시 시도하십시오.


A similar error appears while pulling the changes from the origin. If you are trying in Intellij from the menu options, the pull might not work directly.

Go to terminal and type this command and this should work out: git pull origin master


Sometimes you don't have a local REF for pushing that branch back to the origin.
Try

git push origin master:master

This explicitly indicates which branch to push to (and from)

참고URL : https://stackoverflow.com/questions/32238616/git-push-fatal-origin-does-not-appear-to-be-a-git-repository-fatal-could-n

반응형