"커밋 실패 오류 : pathspec… 파일과 일치하지 않음"메시지가 나타나는 이유는 무엇입니까?
Git에 문제가 있습니다.
문제없이 모든 파일을 커밋 할 수있는 저장소가 있습니다. 그러나 커밋을 시도하면 다음과 같은 오류가 있음을 알려주는 단일 파일 'Funder.php'가 있습니다.
Commit failed with error:
pathspec 'application/libraries/Funder.php' did not match any file(s) known to git.
나는 이것에 대해 아주 새로운 것이므로 누구든지 도와 줄 수 있는지 궁금합니다.
실행을 시도 할 때 발생하는 오류입니다.
git commit <file>
그러나 <file>
아직 상연되지 않았습니다. 즉, Git은 아직 그것에 대해 말하지 않았습니다. 이것은 여기서 일어나는 일일 가능성이 큽니다. 운영
git add application/libraries/Funder.php
그런 다음 커밋을 시도하십시오.
이 오류가 발생하는 이유는 다음 게시물에 나와 있습니다. https://stackoverflow.com/a/29485441/2769415
Windows의 파일 시스템은 대부분 대소 문자를 구분하지 않으므로 대소 문자 만 변경해도 파일 이름을 바꿀 수 없습니다. 대신 중간에 임시 이름을 사용해야합니다.
해결 방법 : 파일 이름을 다시 원래 이름으로 바꾼 다음 다른 이름으로 바꾼 다음 올바른 대소 문자를 사용하여 다시 이름을 바꿉니다. Git은 더 이상 버그를 던지지 않습니다.
예:
Created FOOBar class.
Renamed it to FooBar and then got the error.
Rename it back to FOOBar.
Rename to FooBarTest.
Rename to FooBar.
Git works now.
일부 활동의 이름을 바꾼 후 Android Studio에서 동일한 문제가 발생했습니다. 파일을 추가 (git add)하고 이동 (git mv)하려고했지만 도움이되지 않았고 동일한 메시지를 반복해서 받고있었습니다.
마지막으로 문제가있는 파일이있는 패키지의 클래스를 HDD의 별도 폴더에 백업하기로 결정한 다음 원본 폴더에서 파일을 제거하고 터미널에서 다음을 수행했습니다.
rm app/src/main/java/com/path/to/package/with/problematic/files/
그런 다음 Android Studio를 통해 삭제 된 패키지를 다시 만들고 여기에 내 수업을 복사하여 붙여 넣었습니다. 그 후 아무런 문제없이 커밋 할 수있었습니다.
다음은이 문제를 해결하는 가장 빠른 방법에 대한 간결한 답변입니다. @ cmbind55 게시물과 비슷하지만 요점은 있습니다.
문제 : 나중에 이름을 바꾼 파일을 추가했습니다.
해결책:
- 이전 파일 이름 추가 해제
git reset HEAD oldFileName.file
- 이제 새 파일 이름을 추가하십시오.
git add newFileName.file
- 헌신하고 행복하세요
이름이 변경된 디렉토리로 인해 실패한 커밋 시나리오가있었습니다.
이것은 대소 문자 오류가있는 원래 생성 된 디렉토리입니다.
application/Templates/lists/index.html
IDE 내에서이 파일을 기존 git repo에 추가하는 데 동의했습니다. 나중에 테스트에서 "Templates"의 대문자로 대소 문자를 구분하는 경로 문제가 있음을 발견했습니다. IDE 내에서 디렉토리 이름을 "templates"(소문자로 변경)로 변경했습니다. 이 문제에 대한 실제 이벤트 시퀀스를 기록하지 않았지만 나중에 다음 메시지와 함께 커밋이 실패했을 때이 문제가 직감했습니다. 분명히 IDE는 디렉토리 이름을 바꾸는이 경우를 완전히 처리하지 못했습니다.
IDE 커밋 오류 메시지 :
커밋 실패 오류 : pathspec "application / templates / lists / index.html"이 git에 알려진 파일과 일치하지 않습니다.
약간의 읽기를 마친 후 제 전략은 파일을 다시 꺼내고 다시 추가하는 것이 었습니다. 용의자 파일 준비 해제
git reset HEAD lists/Templates/lists/index.html
git status는 여기에 디렉토리 만 표시했습니다. 파일이 아닙니다.
Untracked files:
(use "git add <file>..." to include in what will be committed)
lists/templates/
그런 다음 수정 된 디렉토리 이름으로 다시 추가했습니다 (git status의 리드에 따라 추가 경로 만 사용했습니다).
git add lists/templates/
그 후, 내 커밋이 성공했습니다. 이것이 이상적인 기술인지 확실하지 않지만 제 경우에는 커밋 오류가 해결되었습니다.
나는 같은 문제가 있었다. '초기 주석 작은 따옴표' '를 큰 따옴표 ""로 변경하십시오.
비슷한 문제가 있었지만 수정했습니다. Windows 명령 줄에서 ''대신 ""를 사용해야했습니다.
나는 같은 문제가 있었다. 여기에 나온 답변 중 어느 것도 문제 해결에 도움이되지 않았습니다. 이틀 동안 꼼짝도하지 않고 경로가있는 파일 이름 전체가 매우 길다는 점에 주목했습니다. 나는 전체 파일 이름 길이를 줄이기 위해 덜 복잡한 이름으로 리팩토링하고 폴더를 재정렬했습니다.
iOS 9.2.1, Xcode 7.2.1, ARC 활성화
Ran into this while changing "contents.json" file for my LaunchImage asset catalog. You may elect to use the terminal commands provided as the answer, but try this simpler way...
Source Control -> Refresh Status
Hope this helps. Cheers!
if working from terminal ensure that you have a message flag in your command.
git commit "Your Commit Message" //Throws an error: pathspec '3.
git commit -m "Your Commit Message" //No error thrown
i had the same issue with the word "certificate" as a package name... when i rename the Package to "certificates" it just work... strange ..
With XCode 7.3 I renamed the file in question to FooBar.foo.tmp and then commited once XCode/git added this new file and set the old one to be deleted. Once I commited then I renamed it back (within XCode). Now it's fine. C'est la vie.
My problem was that I was copy / pasting the entire commit line, and it had special characters, which appeared to be normal characters in the console (ex: smart quotes instead of normal quotes). Once I pasted them into a plain-text editor, I saw them, corrected them, and it worked.
I had the same problem with '.entitlements' file, deleting existing file and adding it again worked for me.
I had a similar problem committing deleted files with SourceTree in Mac. One of the problematic files had accents (áéíóú...). To solve it I had to use terminal rather than SourceTree
I've experienced this by mistakenly creating the branch in a different repo on BitBucket, so make sure you're in the right repo and that the branch exists there.
I got the same error. I was passing the commit message as part of command line argument. The commit message I was passing with double quotes.
In git commit I was using double quotes again. This was throwing the same error.
So I removed the double quotes from the commit message while calling git commit. This fixed my issues.
git commit -m "%commit_message%"
The above command was throwing the same error
I have changed it to
git commit -m %commit_message%
This fixed my issue.
In my case the troublesome file was marked with --skip-worktree
. This could be easily checked with
git ls-files -v . | grep ^S
'program story' 카테고리의 다른 글
Elixir에서 셸 명령 실행 (0) | 2020.11.24 |
---|---|
작업자, 작업자 인스턴스 및 실행자 간의 관계는 무엇입니까? (0) | 2020.11.24 |
redux에서 상수의 요점은 무엇입니까? (0) | 2020.11.24 |
spring.jpa.hibernate.ddl-auto 속성은 Spring에서 정확히 어떻게 작동합니까? (0) | 2020.11.24 |
Vuex-계산 된 속성“name”이 할당되었지만 setter가 없습니다. (0) | 2020.11.24 |