Programing

원격 지점으로 푸시 할 수 없습니다. 지점으로 확인할 수 없습니다.

lottogame 2020. 11. 19. 07:47
반응형

원격 지점으로 푸시 할 수 없습니다. 지점으로 확인할 수 없습니다.


Bitbucket 또는 Github에서 내 저장소를 마이그레이션했습니다. 나는 이것이 중요하다고 생각하지 않지만 유일한 차이점은 ... 잠시 동안 두 개의 리모컨을 설정했습니다.

origin: bitbucket
github: github

그런 다음 github에 대한 원점을 모두 제거했습니다.

git remote remove origin
git remote remove github
git remote add origin https://github....

개발 분기의 테스트 푸시 :

git push origin develop

모든 것이 최신 상태입니다. 좋습니다.

평소대로 일부 작업에 대한 새 분기를 만듭니다.

git checkout -b Feature/Name

파일을 한두 개 업데이트하십시오. 원격으로 푸시 시도 :

git push origin Feature/Name

이로 인해 오류가 발생합니다.

치명적 : 기능 / 이름을 분기로 확인할 수 없습니다.

이 문제를 온라인으로 검색하고 HEAD가 올바른지 확인하는 방법에 대한 정보를 찾아보고, 내 브랜치 이름 대소 문자가 올바른지 확인하는 방법에 대해 알아보세요 (이 시점에서 브랜치는 아직 원격에 존재하지 않습니다). 해결할 수 없습니다.

다음 명령을 실행했습니다.

git push --all -u

이것은 내 Feature/Name지점을 github로 가져 왔지만 여전히 이전과 동일한 동작을 보입니다.

git push origin develop
git push origin Feature/Name

첫 번째는 작동하고 두 번째는 동일한 오류를 발생시킵니다.

이 오류가 발생하는 이유를 알 수 없습니다. 어떤 아이디어?


나도이 문제를 겪고 있었고 그것은 나를 미치게 만들었다. 나는 뭔가를 가지고 feature/name있지만 git branch -a보여주었습니다 FEATURE/name. 브랜치의 이름을 바꾸고 삭제하고 다시 생성해도 아무 효과가 없었습니다. 마지막으로 수정 한 사항 :

들어가다 .git/refs/heads

당신은 볼 수 FEATURE폴더에 있습니다. 이름을 feature.


내 자신의 테스트와 OP의 의견을 기반으로 , 어느 시점에서 지점 이름의 대 / 소문자를 어리석은 것 같습니다.

첫째, OP가 OS X 또는 Windows와 같은 대소 문자를 구분하지 않는 운영 체제에 있다고 생각합니다. 그런 다음 그들은 이렇게 했어요 ...

$ git checkout -b SQLMigration/ReportFixes
Switched to a new branch 'SQLMigration/ReportFixes'

$ git push origin SqlMigration/ReportFixes
fatal: SqlMigration/ReportFixes cannot be resolved to branch.

대소 문자 차이에 유의하십시오. 또한 오류는 이름을 오타하는 경우와 매우 다릅니다.

$ git push origin SQLMigration/ReportFixme
error: src refspec SQLMigration/ReportFixme does not match any.
error: failed to push some refs to 'git@github.com:schwern/testing123.git'

Github는 파일 시스템을 사용하여 브랜치 이름을 저장하기 때문에 .git/refs/heads/SqlMigration/ReportFixes. 파일 시스템은 대소 문자를 구분하지 않기 때문에 성공적으로 열리지 .git/refs/heads/SqlMigration/ReportFixes만 브랜치 이름을 대소 문자를 구분하여 비교하려고하는데 일치하지 않을 때 혼란스러워집니다.

그들이 어떻게 지역 지점이 SQLMigration/ReportFixes있고 원격 지점이 있는 상태에 들어 SqlMigration/ReportFixes갔는지 잘 모르겠습니다. 나는 Github가 원격 지점 이름을 망쳤다 고 생각하지 않습니다. 가장 간단한 설명은 푸시 액세스 권한이있는 다른 사람이 원격 지점 이름을 변경 한 것입니다. 그렇지 않으면 어떤 시점에서 오타로 리모컨을 만들 수있는 작업을 수행했습니다. 셸 기록을 확인 history | grep -i sqlmigration/reportfixes하면 대소 문자를 잘못 입력 한 명령을 찾을 수있을 것입니다.


Git을 사용하면 대소 문자가 다른 현재 분기를 확인할 수 있으며 원격에서 참조를 찾지 못합니다.

방금 어려운 길을 찾았습니다.


나에게도 비슷한 일이 일어났습니다. "Feat / name"과 같은 이름의 브랜치를 만들었습니다. 나는 그것을 사용하여 밀어 보았습니다.

git push --set-upstream origin 기능 / 이름

나는 당신과 같은 치명적인 오류가 있습니다.

치명적 : 기능 / 이름을 분기로 확인할 수 없습니다.

이 문제를 해결하기 위해 영향을받은 파일이 거의 없었기 때문에 새 분기를 만들었습니다. 그런 다음 잘못된 분기를 삭제하기 위해 분기를 나열했는데 모자없이 표시됩니다.

  • 업적 / 이름

나는 전에 모자를 사용했지만 첫 번째 caracter에는 한 번도 사용하지 않았습니다. 자식이 좋아하지 않는 것 같습니다 ...


제 경우에는 대문자로 브랜치 폴더 (또는 그 이름이 무엇이든간에)가 있었는데, 대소 문자가 다른 새 폴더 (소문자)를 만들었지 만 실제로 git은 대문자로 브랜치를 만듭니다.

I have created a branch like feature-ABC/branch1 before and pushed it. Then I create a branch feature-abc/branch2 (notice the lower-case ABC), and try to push it to remote using git push --set-upstream origin feature-abc/branch2 and get the 'cannot be resolved to branch' error. So I git branch and see that it actually created feature-ABC/branch2 instead of feature-abc/branch1 for me. I checkout again with git checkout feature-ABC/feature2 and push it using the uppercase (feature-ABC/feature2) to solve it.


I faced the same issue which was due to going to branch with wrong casing. git let me switch to branch with incorrect casing ie feature/Name instead of feature/name. Found an easier solution than listed above just:

  • commit your changes to 'feature/Name'
  • git checkout master (or develop)
  • git checkout feature/name < with correct casing
  • git push

Maybe your forgot to run git fetch? it's required to fetch data from the remote repo! Try running git fetch remote/branch


You might have created similar branch but different case-sensitive-wise, then you have to run:

git branch -D <name-of-different-case-branch>

and then try to push again.


If you are in local branch, could rename the branch "Feature/Name" to "feature/Name"

git -m feature/Name

if you have problems to make a git push make a checkout in other branch (ex develop) and return to renamed branch

git checkout feature/Name

and try again your git push


Slightly modified answer of @Ty Le:

no changes in files were required for me - I had a branch named 'Feature/...' and while pushing upstream I changed the title to 'feature/...' (the case of the first letter was changed to the lower one).


I just had this issue as well and my normal branches start with pb-3.1-12345/namebranch but I accidental capitalized the first 2 letters PB-3.1/12345/namebranch. After renaming the branch to use lower case letters I could create the branch.


for me I was naming branch as

Rel4.6/bug/Some-short-description

all I had to do is when using

git push origin Relx.x/bug/Some-short-description

to write

git push origin relx.x/bug/Some-short-description

as I used to create branches using small letter r in rel.

so, what caused this issue?

when I listed .git/refs/heads content I found

drwxr-xr-x  4 eslam_khoga  staff   128B Sep 22 20:22 relx.x

but no Relx.x!

and inside it bug and inside bug my branch's name.

So, git try to create a dir with same name but different case letters

but system is not case sensitive.

That's what caused this issue!

참고URL : https://stackoverflow.com/questions/38034866/cant-push-to-remote-branch-cannot-be-resolved-to-branch

반응형