根目录下有一个 .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)
$
世界只因有你2017-04-27 09:05:44
You need to delete the remote .idea directory first.
In this case, you didn’t consider it before designing gitignore. The current measures are:
rm -rf .idea (This will delete your local one, but it will be automatically generated for you if you reopen the project)
git add -A .
Submit
git pull
Pull and check again after synchronization to see if the remote ones have been deleted; if there are local ones, repeat again.
After cleaning, run git rm -r --cached .idea to cancel tracking
Let’s push
phpcn_u15822017-04-27 09:05:44
Files already tracked by git cannot be written in the gitignore file.
怪我咯2017-04-27 09:05:44
.gitignore
先不添加忽略的那行,直接删除 .idea
file and submit.gitignore
里添加 .idea/*
.gitignore
, overPHPz2017-04-27 09:05:44
Use git rm -fr .idea
to delete local .idea files,
Add .idea to the .gitignore file for filtering
Save and submit to the remote end, and then you find that it has been cleared
迷茫2017-04-27 09:05:44
# The execution steps are as follows:
Add .idea/ to the file first. ignore file.
2. Delete local. idea file
3.git add.
git commit -m "update .ignore file"
git push origin master
6. Open the file with the local idea, and you will see that the local .idea file is back.