git 无法删除 .idea 目录
怪我咯
怪我咯 2017-04-27 09:03:44
0
5
1272

根目录下有一个 .idea 文件夹,我已经在 根目录下的 .gitignore 文件中加入了

.idea/*
.idea*
\.idea*

然后 git commit -m "ignore .idea dir" -> git push -u origin ->
但是远程的git 中还是有 .idea 这个目录。无法删除。

Administrator@PC-20140703LOZL /D/PC/ppgame (master)
$ git rm --cached .idea/*
fatal: pathspec '.idea/encodings.xml' did not match any files

Administrator@PC-20140703LOZL /D/PC/ppgame (master)
$ git rm --cached .idea
fatal: pathspec '.idea' did not match any files

Administrator@PC-20140703LOZL /D/PC/ppgame (master)
$ git rm --cached .idea/*.*
fatal: pathspec '.idea/encodings.xml' did not match any files

Administrator@PC-20140703LOZL /D/PC/ppgame (master)
$ git rm --cached .idea*
fatal: pathspec '.idea' did not match any files

Administrator@PC-20140703LOZL /D/PC/ppgame (master)
$ git rm --cached \.idea*
fatal: pathspec '.idea' did not match any files

1)如何才可以删除git中跟踪的 .idea目录但是又不删除本地的 .idea 文件夹?
2)是不是遇到文件夹中有. 这样特殊字符的,在.gitignore中需要转义?


我使用了 git rm -r --cached .idea 但是报错,删除不了。远程还在


Administrator@PC-20140703LOZL /D/PC/ppgame (master) $ git rm -r --cached .idea fatal: pathspec '.idea' did not match any files Administrator@PC-20140703LOZL /D/PC/ppgame (master) $ git push -u orign --all fatal: 'orign' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Administrator@PC-20140703LOZL /D/PC/ppgame (master) $ git push -u orign/master --all fatal: 'orign/master' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Administrator@PC-20140703LOZL /D/PC/ppgame (master) $
怪我咯
怪我咯

走同样的路,发现不同的人生

répondre à tous(5)
世界只因有你

Vous devez d'abord supprimer le répertoire .idea distant.

Dans ce cas, vous n'y avez pas pensé avant de concevoir gitignore. Les mesures actuelles sont :

rm -rf .idea (Cela supprimera votre projet local, mais il sera automatiquement généré pour vous si vous rouvrez le projet)

git add -A .
Soumettre
git pull

Après avoir extrait, vérifiez si les distants ont été supprimés après la synchronisation ; s'il y en a des locaux, répétez à nouveau.

Après le nettoyage, exécutez git rm -r --cached .idea pour annuler le suivi
Poussons

phpcn_u1582

Les fichiers déjà suivis par git ne peuvent pas être écrits dans le fichier gitignore.

刘奇
  1. .gitignore N'ajoutez pas d'abord la ligne ignorée, supprimez le fichier .idea directement, puis soumettez
  2. Ouvrez .gitignore et ajoutez .idea/*
  3. Envoyer .gitignore, terminé
PHPzhong
  1. Utilisez git rm -fr .idea pour supprimer le fichier .idea local,

  2. Ajoutez .idea au fichier .gitignore pour filtrer

  3. Enregistrez et soumettez à l'extrémité distante, puis vous constatez qu'il a été effacé

迷茫

# Les étapes d'exécution sont les suivantes :

  1. Ajoutez d'abord .idea/ au fichier. ignorer le fichier.
    2. Supprimer le local. fichier idée

3.git ajouter.

  1. git commit -m "mettre à jour le fichier .ignore"

  2. git push origin master
    6. Ouvrez le fichier avec l'idée locale et vous verrez que le fichier .idea local est de retour.

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal