Does not appear to be a Git repository could not read from remote repository?

프로그래밍 농장

IT 관련 정보

[Git] github 사용 중, fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. 에러 해결법

allround master 2022. 2. 18. 01:40

먼저 원격 연결이 어떻게 되어있는지 확인한다. 

git remote -v

만약에 origin 말고 다른 이름으로 연결이 되어 있으면 삭제해주고 다시 연결해줘도 된다.

git remote remove [이름]

아무것도 연결되어 있지않다면, 아래와 같이 원격저장소와 로컬을 연결해주면 된다.

git 저장소와 연결을 진행한다.

git remote add origin [git 저장소 url]

이후 push 나 pull 을 수행해보면 문제없이 작동하는것을 확인할수있다.

수정된 소스를 원격저장소로 밀어넣기 위해서 다음과 같은 명령어를 실행하였습니다.

git push -u origin master

하지만 아래와 같은 메세지를 받게 되었습니다.

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

원인 파악.

영어 내용을 보아하니, Repository를 못 찾는다는 내용이며, 

원인은 다음과 같이 2가지의 경우로 볼 수 있습니다.

1. 원격저장소 연결의 문제가 있는 경우

  • 저장소 연결 확인
  • 연결된 주소 해제
  • 주소 재연결

2. 원격저장소 연결이 되어 있지 않는 경우

  • 저장소 연결 확인
  • 저장소 생성
  • 저장소 생성하는 부분은 아래 URL 참고

해결.

여기서는 원격저장소 연결의 문제가 있는 경우에 대해서 알아보도록 하겠습니다.

다음 순서대로 진행 시 

1. 저장소 연결 확인

git remote -v origin https://github.com/codeleesh/repo-create-test.git (fetch) origin https://github.com/codeleesh/repo-create-test.git (push)

2. 연결된 주소 해제

git remote remove origin

3. 주소 재연결

git remote add origin git https://github.com/codeleesh/repo-create-test.git

- 환경

GitBash v2.30.2(2)

Windows 10

- 발생 에러 

로컬에 미리 디렉토리를 만들고, 이 로컬 디렉토리와 github 원격 저장소에 연결을 하여 push를 하려는 데, 이와 같은 에러가 발생.

HWANG@DESKTOP-FCOI9PT MINGW64 /a/4M (master) $ 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

찾아보니, 연결된 것을 삭제하고 다시 연결을 하면 해결된다고 함.

보니까 내가 origin위치에 orgin으로써서 인식을 제대로 못한 것이었다...

이와 같이 말이다

HWANG@DESKTOP-FCOI9PT MINGW64 /a/4M (master) $ git remote add orgin https://github.com/hswon37/4M.git

git remote add 명령어 때 잘못 입력한 이름을 remove하고 다시 add하면 해결

HWANG@DESKTOP-FCOI9PT MINGW64 /a/4M (main) $ git remote remove orgin

다시 add하면 해결

HWANG@DESKTOP-FCOI9PT MINGW64 /a/4M (main) $ git remote add origin https://github.com/hswon37/4M.git HWANG@DESKTOP-FCOI9PT MINGW64 /a/4M (main) $ git branch -M main HWANG@DESKTOP-FCOI9PT MINGW64 /a/4M (main) $ git push -u origin main Enumerating objects: 38, done. Counting objects: 100% (38/38), done. Delta compression using up to 8 threads Compressing objects: 100% (24/24), done. Writing objects: 100% (38/38), 70.10 KiB | 1.23 MiB/s, done. Total 38 (delta 0), reused 0 (delta 0), pack-reused 0 To https://github.com/hswon37/4M.git * [new branch] main -> main Branch 'main' set up to track remote branch 'main' from 'origin'.

- 결론

오타를 조심하자

참고: https://jjunii486.tistory.com/153

git] 원격 저장소 연결 에러 'origin' does not appear to be a git repository

pull 혹은 push 를 하는 도중에 원격 저장소 에러가 떴다! *** 에러 과정 *** 1) pull 명령어를 사용 git pull master 2) 에러발생 메시지 git pull master fatal: 'master' does not appear to be a git reposito..

jjunii486.tistory.com

Does not appear to be a Git repository could not read from remote repository?

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

Does not appear to be a Git repository could not read from remote repository?

위와 같은 에러가 발생한다면

git remote -v

로 github repository 연결되어 있나 확인

아무런 내용도 안뜨면 

git remote add origin https://github.com/username/repo이름.git

로 추가 현재 프로젝트에 등록된 리모트 저장소 추가

그 후 git pull 진행

git pull origin master

이러면 이상없이 동작하는 것을 확인할 수 있습니다.

저작자표시

'기타 > Github' 카테고리의 다른 글

GIT fatal: 'master' does not appear to be a git repositoryfatal: Could not read from remote repository. 발생 시  (0) 2021.02.08
Github 다뤄보기  (0) 2021.01.20