Gitignore不会更新我的仓库中的文件

mpg*_*pgn 1 git push github gitignore git-commit

我的git有一个简单的问题:

我在github上的存储库中有这个文件inc.conf.php.我不想从回购中删除他,这是一个基本的配置文件.

现在,在我的本地仓库中,我有自己的配置文件inc.cong.php,我不希望这个文件被提交.

所以我创建了一个.gitignore并在其中添加了inc.config.php.(. gitignore是提交并推送回购)

但是当我更新本地和磁带中的文件inc.config.phpgit 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:   Swindle-Foundation5/inc.config.php

no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)

但我不想从github更改存储库中的文件.我怎么能这样做?

Chr*_*ris 6

.gitignore仅用于防止跟踪文件.跟踪文件后,忽略文件对其没有影响.

您可以使用Git忽略对文件的更改git update-index --assume-unchanged Swindle-Foundation5/inc.config.php.