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

根目录下有一个 .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) $
怪我咯
怪我咯

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

membalas semua(5)
世界只因有你

Anda perlu memadamkan direktori .idea jauh dahulu.

Dalam kes ini, anda tidak mempertimbangkannya sebelum mereka bentuk gitignore Langkah-langkah semasa ialah:

rm -rf .idea (Ini akan memadamkan idea tempatan anda, tetapi ia akan dijana secara automatik untuk anda jika anda membuka semula projek)

git add -A .
Serahkan
git pull

Selepas menarik, semak untuk melihat sama ada yang jauh telah dipadamkan selepas penyegerakan jika ada yang tempatan, ulangi sekali lagi.

Selepas pembersihan, jalankan git rm -r --cached .idea untuk membatalkan penjejakan
Jom tolak

phpcn_u1582

Fail yang telah dijejaki oleh git tidak boleh ditulis dalam fail gitignore.

刘奇
  1. .gitignore Jangan tambah baris yang diabaikan dahulu, padamkan fail .idea terus, dan kemudian serahkan
  2. Buka .gitignore dan tambah .idea/*
  3. Serahkan .gitignore, tamat
PHPzhong
  1. Gunakan git rm -fr .idea untuk memadam fail .idea setempat,

  2. Tambahkan .idea pada fail .gitignore untuk ditapis

  3. Simpan dan serahkan ke hujung jauh, dan kemudian anda dapati ia telah dikosongkan

迷茫

# Langkah pelaksanaan adalah seperti berikut:

  1. Tambahkan .idea/ pada fail dahulu. abaikan fail.
    2. fail idea

Tambah 3.git.

  1. git commit -m "kemas kini .abaikan fail"

  2. git push origin master
    6 Buka fail dengan idea tempatan dan anda akan melihat bahawa fail .idea tempatan telah kembali.

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan