[오류해결] fatal: The current branch master has no upstream branch.To push the current branch and set the remote as upstream

2022. 2. 15. 14:20·레거시모음/오류해결

 

git push 명령어를 사용했을 때 아래와 같은 에러가 발생하면 어떻게 해야할까?

$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

 

브랜치를 master로 언급하여 푸시해도 에러가 발생했다.

$ git push origin master
bash: $'\302\226git': command not found

 

 

이 에러의 원인은 원격저장소에 대한 브랜치 설정이 안되어있기 때문에 그런 것이다.

깃에서 제시해준 해결방법을 그대로 사용하면 대체로 해결이 된다. 

$ git push --set-upstream origin master

 

- 해결완료

$ git push origin master
Enumerating objects: 35, done.
Counting objects: 100% (35/35), done.
Delta compression using up to 8 threads
Compressing objects: 100% (19/19), done.
Writing objects: 100% (25/25), 539.61 KiB | 23.46 MiB/s, done.
Total 25 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 1 local object.
To https://github.com/pythonstrup/Spring-Boot-JPA-Blog.git
   3283fff..56fe365  master -> master

 

 

 

** 만약 해결되지 않는다면? **

 

git remote -v 명령을 통해 원격저장소를 불러와보자.

$ git remote -v
origin  https://원격저장소_주소.git (fetch)
origin  https://원격저장소_주소.git (push)

그 다음에 git push origin master를 치면 remote -v를 통해 찾은 원격저장소 master 브랜치에 푸시된다.

$ git push origin master

 

'레거시모음/오류해결' 카테고리의 다른 글
  • [Spring Boot][오류해결] Executing an update/delete query
  • [오류해결][Git] merge Conflict 해결
  • [Spring Boot][오류해결] Parameter 0 of constructor in ~~ required a bean of type ~~ that could not be found.
  • [Spring Boot][오류해결] Parameter 0 of constructor in ~~ required a single bean, but 2 were found
gakko
gakko
좌충우돌 개발기
  • gakko
    MYVELOP 마이벨롭
    gakko
  • 전체
    오늘
    어제
    • 분류 전체보기 (211) N
      • 끄적끄적 (6)
      • Spring (20) N
      • Java (3)
      • Redis (2)
      • Test (3)
      • 대외활동 (36)
        • 부스트캠프 (23)
        • IT커뮤니티 (5)
        • 글또 (5)
        • 컨퍼런스 (3)
      • Infra (5)
        • Docker (1)
        • Jenkins (1)
        • AWS (1)
      • CS (26)
        • 자료구조 (13)
        • 운영체제 OS (12)
        • 데이터베이스 (1)
      • MySQL (7)
      • Git & GitHub (16)
        • Git (12)
        • Github Actions (1)
        • 기타(마크다운 등) (3)
      • 프로젝트 (2)
      • 리눅스 (6)
        • 기초 (6)
        • 리눅스 서버 구축하기 (0)
      • 후기 (3)
        • Udemy 리뷰 (3)
      • Python (12)
      • 레거시모음 (64)
        • 스프링 (11)
        • 자바 클래스&메소드 (1)
        • 오류해결 (18)
        • JSP & Servlet (12)
        • 자바스크립트 기초 (3)
        • React (2)
        • 이클립스 (1)
        • 알고리즘 문제풀이 (16)
      • 디자인패턴 (0)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • 우진님
  • 공지사항

  • 인기 글

  • 태그

    스프링
    파이썬
    알고리즘
    부스트캠프 멤버십
    Spring
    os
    부스트캠프 7기
    MySQL
    자바스크립트
    자바
    스프링부트
    Python
    java
    운영체제
    GitHub
    jsp
    부스트캠프
    웹개발
    오류해결
    Git
  • 최근 댓글

  • hELLO· Designed By정상우.v4.10.0
gakko
[오류해결] fatal: The current branch master has no upstream branch.To push the current branch and set the remote as upstream
상단으로

티스토리툴바