it-source

.gitignore가 .vmx 경로를 무시하지 않습니다.

criticalcode 2023. 6. 30. 22:26
반응형

.gitignore가 .vmx 경로를 무시하지 않습니다.

내가 놓치고 있는 것은 무엇인가, 그것을 얻기 위해 행해져야 합니다.git내 말을 무시하는 것은.idea/ 길? 길?

ctote@ubuntu:~/dev/1$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   .idea/.name
    modified:   .idea/misc.xml
    modified:   .idea/modules.xml
    modified:   .idea/vcs.xml
    modified:   .idea/workspace.xml
    modified:   src/Receiver.java
    modified:   test/1/agent/WindowsQueryHandlerTest.java

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    lib/
    mp1.iml

no changes added to commit (use "git add" and/or "git commit -a")

ctote@ubuntu:~/dev/1$ cat .gitignore
*.class

# Package Files #
*.war
*.ear

# IDEA config files
.idea/

.gitignore새로 추가된(추적되지 않은) 파일만 무시합니다.

저장소에 이미 추가된 파일이 있는 경우 .gitignore 규칙과 일치하더라도 모든 변경 내용이 정상적으로 추적됩니다.

디스크에서 삭제하지 않고 해당 폴더를 저장소에서 제거하려면 다음 작업을 수행합니다.

git rm --cached -r .idea

더하다.idea/ 파일입니다.

터미널에서 이 명령을 실행하여 임무를 완료합니다 :)

git rm -rf .idea
git commit -m "delete .idea"
git push

"fatal: pathspec '.idea'가 어떤 파일과도 일치하지 않음"을 제거하려면 dir가 여전히 추적되지 않은 상태로 반환되는 경우에만 사용합니다.

git clean -f -d .idea

아래 명령 실행 저장소에서 파일 제거

git rm --cached .idea/

이제 gitignore 파일을 무시하도록 업데이트합니다.gitignore 폴더 아래 명령 실행

echo '.idea' >> .gitignore

.gitignore 파일 추가

git add .gitignore

git commit -m "Removed .idea files"

여러분들 중에.fatal: pathspec '.idea' did not match any files:

.idea 폴더의 전체 경로를 포함하면 됩니다.

그서일단을 .git status당신에게 길을 보여줄 것입니다..idea당신이 현재 있는 곳을 고려할 때.

다음 제안하는 합니다. " " " w0lf " " 입니다.git rm --cached -r example/path/to/.idea

다른 답변의 단계를 수행한 후에도 bash 또는 powershell에서 실행 중인 git 인스턴스가 .idea/ 폴더를 계속 추적하는 것을 발견하면 이를 시도해 보십시오!

Jet Brains IDE는 자체 .gitignore를 가지고 있으며 .gitignore 설정을 재정의하는 자체 git 인스턴스를 실행한다는 것을 알게 되었습니다!

이 문제를 해결하기 위해 제가 한 일은 /.idea/.gitignore로 이동하고 내용을 다음으로 변경하는 것이었습니다.

/**

폴더에 있는 모든 것을 무시할 수 있습니다.

아래 이미지는 Jetbrain IDE 내에서 .gitignore 파일로 이동하는 방법을 보여줍니다.

Locating .gitignore

  1. .gitignore 파일을 변경하고 저장합니다.
  2. CMD를 admin 또는 Termin으로 열고 Project 폴더로 이동합니다.
  3. 려달을 합니다.git rm -r --cached .idea/
  4. 려달을 합니다.git add .
  5. 려달을 합니다.git commit -m "chore: Rider files ignored."

자세한 내용은 깃무시 수정 방법을 참조하십시오.

제 경우, 제 .gitignore에는 다음과 같은 행이 있습니다.

### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml
.idea/.idea.TemplateProject/.idea/indexLayout.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

위에 언급된 모든 좋은 해결책들로 인해, 그들 중 어떤 것도 저에게 효과가 없었습니다. 왜냐하면 제가 한 실수가 여기에 있었기 때문입니다.프로젝트를 생성하는 동안 해당 설정을 무시했습니다!

  1. 2개가 있었습니다..gitignore프로젝트 수준 파일을 업데이트하지 못했습니다.
  1. 생성하는 이미 때문에명령이 됩니다. 이/경로는 에 되어 있음에도 항상 에서 생성됩니다..gitignore.

해결책

  • 문제 2에 초점을 맞추고 먼저 원격에서 해당 폴더/디렉토리를 삭제했습니다.
  • 현지인들을 끌어들였어요
  • Viola! 더 이상 무시된 파일을 추적할 수 없습니다!

위의 명령을 입력한 후 "fatal: pathspec '.idea'가 어떤 파일과도 일치하지 않음" 오류를 해결하려면,

  1. 아이디어 폴더와 해당 파일의 경로를 확인합니다.
  2. 이를 위하여git status모든 파일이 정상적으로 나열됩니다.아이디어 폴더 파일의 경로를 확인합니다.내 것은../.idea/workspace.xml주의:../.idea
  3. 승인된 답변에서 위의 제안된 명령 수정git rm --cached -r ../.idea
  4. 그러면 이것이 표시됩니다.rm '.idea/workspace.xml'파일이 제거됩니다.

무시한 것에 대하여.idea폴더 및iml파일 형식, 다음 작업을 수행했습니다.

enter image description here

.gitignore 파일에 .git/*가 이미 추가되어 있더라도 git 상태가 여전히 .git로 표시되는 경우 이 항목을 선택합니다.

위의 모든 해결책을 시도해 보았지만 아무 것도 작동하지 않았습니다.

제게 효과가 있었던 것은 제가 추가한 것입니다..idea.gitignore 파일 모두에.(최근 업데이트 기준으로 별도의.gitignore내부에 파일.idea폴더)

그런 다음 커밋 메시지에 표시된 파일을 삭제하고 삭제를 취소했습니다.그것은 깃 캐시에서 지워진 것처럼 보였습니다.

아마도 내 상황은 조금 다를 것이다, 왜냐하면 나의.idea디렉터리는 커밋을 위해 이미 준비되었지만, 실행하기 위해 git 상태 출력에 주어진 조언을 따를 뿐입니다.git restore --staged <file>...:

C:\Devstuff\proj01>git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage) <<< THIS HERE
        new file:   .idea/.gitignore
        new file:   .idea/proj01.iml
        new file:   .idea/modules.xml
        new file:   .idea/vcs.xml

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   .idea/proj01.iml
        modified:   file/that/was/changed.js

그래서 도망쳤어요.

C:\Devstuff\proj01>git restore --staged .idea/

그 후에는 다음과 같이 분류되었습니다.

C:\Devstuff\proj01>git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   webapp/controller/Master.controller.js

언급URL : https://stackoverflow.com/questions/32384473/gitignore-not-ignoring-idea-path

반응형