[TIL] git push 에러 23.5.31

행복한 딸기🍓·2023년 5월 31일
0

TIL

목록 보기
5/7

내 github에 프로젝트를 올리는 상황에

$ git push -u origin main ssh: connect to host github.com port 22: connection timed out fatal: could not read from remote repository. please make sure you have the correct access rights and the repository exists.

이러한 에러가 났다.
자세히 보니 SSH 주소로 하여 에러가 난듯하다.

원격 저장소를 삭제하고 다시 HTTPS로 설정했다.

1. git remote remove origin
2. git remote -v  (삭제되었는지 확인)
3. git remote add origin https://git주소
4. git remote -v (주소가 잘 들어왔는지 다시 확인)
5. git push origin main

error: src refspec main does not match any
error: 레퍼런스를 'https://github.com/ex/ex.git'에 푸시하는데 실패했습니다

이 에러는 git을 초기화 하고 나서 addcommit을 하지 않고 push를 할 때 발생한다.

이것 또한 위와 같은 과정으로
원격 저장소 연결을 삭제한 다음에
다시 github 저장소의 url을 등록하고 진행하면 된다.

profile
🍀먹고 자라는 새싹🌱

0개의 댓글