itsource

herku: src refspec 마스터가 일치하지 않습니다.

mycopycode 2023. 8. 20. 10:48
반응형

herku: src refspec 마스터가 일치하지 않습니다.

저는 헤로쿠를 진행하고 있습니다.누를 때:

git push master Heroku

오류가 발생했습니다.

error: src refspec master does not match any.
error: failed to push some refs to 'git@heroku.com: etc ...'

이것은 나를 위한 일입니다.

git push heroku HEAD:master

저는 그 문제를 경험했습니다.저는 이 문제를 이렇게 해결했습니다.

  1. 서류철로 무엇이든

  2. 저지르다

  3. 밀다

     $ touch readme
    
     $ git add .
    
     $ git commit -m "init"
    
     $ git push heroku master
    

왜인지 모르겠다.

언뜻 보기에 당신은 당신의 것을 가지고 있는 것처럼 보입니다.master그리고.Heroku 인 " " " " " " " " " " " " " " " " " " " " " " " "git push원격 저장소의 이름이어야 하며, 두 번째 이름은 refspec(분기 포함)입니다.은 다과같분있기높가습다니이능성을가은음▁called▁branch다높니▁a▁you습▁likely▁to▁more▁have라고 불리는 지점을 가질 가능성이 더 높습니다.master 라고 리모콘는라는 .Heroku하지만 그런 경우에는 다음과 같은 다른 오류 메시지가 표시될 것으로 예상됩니다.

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

오류 표는오메로는없의다미니합음을컬이시가 없다는 것을 합니다.master.때까지 를 만들지 않기 에 아직 않은 됩니다.Git가 첫 번째 커밋까지 분기를 만들지 않기 때문에 아직 커밋을 수행하지 않은 경우가 해당됩니다.다음을 실행하여 확인할 수 있습니다.

git show-ref

가 포함된 줄이 보일 입니다.refs/heads/master마스터 브랜치가 있는 경우.그렇지 않은 경우 실행해 보십시오.

git commit -m 'Initial commit'

다음과 같은 기능을 통해 사용할 수 있는 원격 정보도 확인할 수 있습니다.

git remote -v

Heroku라는 리모컨이 있으면 다음과 같은 것을 볼 수 있습니다.

Heroku  git@heroku.youraccount:yourproject.git (fetch)
Heroku  git@heroku.youraccount:yourproject.git (push)

사용해 보십시오.

git push heroku main

여기서 소스

제가 지역 마스터 지점에 없을 때 헤로쿠에 푸시하려고 할 때 이 오류가 발생했습니다.

로 해결했습니다.

git push heroku my_branch_name:master

교체 및체my_branch_name내가 있던 git branch의 이름으로.이것은 헤로쿠에게 헤로쿠의 마스터 브랜치에 있는 이 지역 브랜치를 받으라고 말하는 것 같습니다.

저 같은 경우는 밀어줄 게 없어서 이렇게 된 거예요.저는 "깃 애드"를 먼저 하는 것을 잊었습니다.실제 콘텐츠에 대해 "git add"를 한 후 "git commit"을 하자마자 푸시가 잘 작동했습니다.

늦은 답변이지만 누군가에게 도움이 될 수 있습니다.

이 대신에:

git push master Heroku

시도:

git push heroku master

사실, 나는 파일을 만들어야 했고, 그렇지 않으면 커밋이 비어 있었습니다.

touch readme.md

2020년 10월 1일부터 Github은 새 리포지토리를 만들 때 기본 분기 이름으로 "master" 대신 "main"으로 기본 설정됩니다.일반적인 단계를 모두 수행한 경우 현재 분기("git branch")를 살펴보고 이로 인해 문제가 발생하지 않는지 확인합니다(나처럼).

https://www.zdnet.com/article/github-to-replace-master-with-main-starting-next-month/

만약 당신이 쓰고 있다면 ->

"git push master Heroku"

그리고 ->와 같은 오류가 발생합니다.

오류: src refspec 마스터가 일치하지 않습니다.오류: 'git@heroku.com : etc'에 대한 일부 참조를 푸시하지 못했습니다.

그리고 하이퍼->의 첫 번째 유형.

git commit -m 'Initial commit'

그리고 만약 다음과 같은 오류가 있다면.

email ,name is not found or something like that

그러면 당신이 herku 페이지에 서명하지 못할 수도 있습니다.

하이퍼 커먼 라인 또는 사용 중인 cmd 라인의 첫 번째 쓰기 유형

git config --global user.email "yourgmail address"

그런 다음 Enter 키를 누르고 입력합니다.

git config --global user.name "Your Name"

그러면 잘 작동할 것입니다.정상적으로 작동하는지 확인하려면 다음과 같이 입력합니다.

git commit -m 'initial commit'

코드를 작성하는 데 시간이 걸릴 것입니다.

git push heroku master

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

이것은 저에게 효과가 있었습니다.

 git config --global user.email "you@example.com"

 git config --global user.name "Your Name"

로컬 컴퓨터의 분기 마스터에 없을 수 있습니다.

체의크웃아로에 합니다.master 지또/는점또main

그리고 나서 하라.

git push heroku master

저는 헤로쿠의 단계별 안내를 따라 이곳에 왔습니다.저에게 이 문제는 저장소에 최소한의 파일을 생성하고 커밋한 다음 herku로 다시 푸시한 후 해결되었습니다.

늦게 들어오지만 저 같은 경우에는:

git push git@heroku.com :appname.git 마스터

나를 위해 그 묘기를 부렸어요!appname은 당신의 herku 앱의 이름입니다.

herku로 푸시하기 전에 먼저 변경사항을 원격 분기로 푸시합니다.

git push origin master
git push heroku master 

마스터 브랜치가 아닌 브랜치를 herku에 푸시하려면

git push origin development_branch
git push heroku development_branch:master

먼저 파일을 커밋해야 합니다.

git commit -m "First commit adding files"

그리고나서

git push heroku master

또한 마스터 브랜치가 다음과 같은지 여부도 확인합니다.main그러면 당신은 사용해야 합니다.

git push heroku main

마찬가지로 마스터가 아닌 분기를 푸시하려면 다음을 사용합니다.

git push heroku <branch_name>

기존 Heroku 앱의 경우

heroku git:remote -a <APP-NAME>

질문의 요점에 맞는 답변을 추가하는 것입니다.

Git가 로컬 보고서에 커밋한 후에만 마스터 분기를 만들기 때문에 이 오류가 발생합니다.repo를 초기화하기만 하면 마스터가 없습니다.

그럼 어떻게 고치죠?

보고서에 변경 사항을 하나 이상 추가하고 커밋한 후 푸시 명령을 다시 실행하십시오.다른 답변에서도 마찬가지로 간단한 .gitignore 파일을 추가하고 커밋할 수 있습니다.

터미널 "testpry git:(ft-heroku-deployment-170679745) gitpush herku master 오류: src refspec master가 일치하지 않습니다.오류: 'https://git.heroku.com/guarded-taiga-41995.git' '에 대한 일부 참조를 푸시하지 못했습니다.

솔루션:당신은 당신이 일하고 있는 지점의 이름을 확인해야 합니다.이 경우, "ft-heroku-deployment-170679745"입니다.

은 $ 오 푸 입 명 은 니 $ 다 시 른git push heroku ft-heroku-deployment-170679745

저도 같은 문제를 경험했습니다.저는 git에 올바르게 서명하지 않았기 때문에 문제가 발생했습니다.브랜치에 .git commit -m "My first commit"이 작업을 수행하려고 할 때 다음과 같은 응답을 받았을 수 있습니다(제가 받은 것처럼).

git: 치명적인 전자 메일 주소 자동 검색 불가("일부 잘못된 전자 메일"을 받았습니다).

응답이 수신된 경우 다음 명령을 사용하여 원하는 git 이메일 및 사용자 이름을 입력해야 합니다.

git config --global user.email "you@example.com"

git config --global user.name "Your Username"

그런 다음 push 명령을 다시 시도합니다.

git push heroku master

이제 될 거예요.

는 두 개의 파일이 이었습니다.package-lock.json그리고.yarn.lock그 중 하나를 삭제하면 문제가 해결되었습니다.다음은 오류 메시지입니다.

 !     Two different lockfiles found: package-lock.json and yarn.lock
       Both npm and yarn have created lockfiles for this application,
       but only one can be used to install dependencies. Installing
       dependencies using the wrong package manager can result in missing
       packages or subtle bugs in production.
       - To use npm to install your application's dependencies please delete
         the yarn.lock file.
         $ git rm yarn.lock
       - To use yarn to install your application's dependences please delete
         the package-lock.json file.
         $ git rm package-lock.json

Heroku와 동일한 앱 이름을 누르고 있는지 확인하십시오.

위의 솔루션이 작동하지 않으면 .git 폴더의 숨겨진 .git 폴더를 확인하여 packed-refs 파일이 있는지 확인합니다. 파일이 없으면 refs/remotes/heroku/main을 참조하는 해시 키가 있어야 합니다.다음 단계를 수행할 수 있습니다.

  • 1단계: herku cli에 로그인합니다.
  • 2단계: cmd herkugit 실행:clone -a your-app-name
  • 3단계: git push 수행

헤로쿠 앱 목록을 가져옵니다.cmd heroku 앱 이하로 실행할 수 있습니다.

다음 단계를 수행합니다.

 $ git init 

 $ git add .

 $ git commit -m "init"

 $ git branch -M main

 $ git push heroku main
  1. herku가 remote로 추가되었는지 확인합니다. git remote -v 다음과 같은 것이 표시됩니다.

heroku https://git.heroku.com/yourapp.git (계속) heroku https://git.heroku.com/yourapp.git (계속)

  1. 없으면 remote - git remote add heroku git@heroku.com :MyApp.git(이전 git 버전) 또는 herrokit:remote -a example-app(새 버전의 git)

  2. git push herku master (old git) git push herku main (new git)

로컬 리포지토리의 복사본을 GitHub repo에 푸시한 후 이 문제가 발생했습니다.

에 그전에.git push heroku master헤로쿠에 배치하는 데 잘 작동하고 있었습니다.

하지만 GitHub에 푸시한 후,git push heroku master을 주기 시작했습니다.error: src refspec master does not match any메시지, 그리고 나는 해야만 했습니다.git push heroku main배포할 수 있습니다.

GitHub에 복사본을 푸시하면 로컬 레포의 지점 이름이 에서 변경된 것 같습니다.master로.main.

언급URL : https://stackoverflow.com/questions/26595874/heroku-src-refspec-master-does-not-match-any

반응형