Skip to main content
edited tags; edited title
Link
Timur Shtatland
  • 12.8k
  • 3
  • 42
  • 70

.gitignore does not work - file is still being tracked

I've a .gitignore.gitignore file at the root of my repo. The .gitignore.gitignore file has the following pattern to exclude the compiled pythonPython files and that is the only line in the file.

*.pyc

*.pyc

Now when i do the following at the root of the repo.

  1. git init
  2. git add .
  3. git status
git init
git add . 
git status 

It shows that it still tracks the .pyc.pyc file and tries to add it as new file. See output below...

System info: WinWindows 7, cygwin

Note: This issue is CLEARLY not about the ignored file being already tracked. Also iI also tried both DOS- and Unit styleUnix-style line endingendings on the .gitignore.gitignore file.

git statusgit status gives:

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   .gitignore
#   new file:   feedapp/__init__.py
#   new file:   feedapp/appconfig.py
#   new file:   feedapp/appconfig.pyc

How do iI troubleshoot this further?

I've a .gitignore file at the root of my repo. The .gitignore file has the following pattern to exclude the compiled python files and that is the only line in the file.

*.pyc

Now when i do the following at the root of the repo.

  1. git init
  2. git add .
  3. git status

It shows that it still tracks the .pyc file and tries to add it as new file. See output below...

System info: Win 7, cygwin

Note: This issue is CLEARLY not about the ignored file being already tracked. Also i tried both DOS and Unit style line ending on the .gitignore file.

git status:

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   .gitignore
#   new file:   feedapp/__init__.py
#   new file:   feedapp/appconfig.py
#   new file:   feedapp/appconfig.pyc

How do i troubleshoot this further?

I've a .gitignore file at the root of my repo. The .gitignore file has the following pattern to exclude the compiled Python files and that is the only line in the file.

*.pyc

Now when i do the following at the root of the repo.

git init
git add . 
git status 

It shows that it still tracks the .pyc file and tries to add it as new file. See output below.

System info: Windows 7, cygwin

Note: This issue is CLEARLY not about the ignored file being already tracked. I also tried both DOS- and Unix-style line endings on the .gitignore file.

git status gives:

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   .gitignore
#   new file:   feedapp/__init__.py
#   new file:   feedapp/appconfig.py
#   new file:   feedapp/appconfig.pyc

How do I troubleshoot this further?

Post Closed as "Duplicate" by hakre, Manuel, RAS, John Kraft, Roman C
deleted 257 characters in body; added 318 characters in body
Source Link
Gnu Engineer
  • 1.6k
  • 2
  • 14
  • 15

I've a .gitignore file at the root of my repo. The .gitignore file has the following pattern to exclude the compiled python files and that is the only line in the file.

*.pyc

Now when i do the following at the root of the repo.

  1. git init
  2. git add .
  3. git status

It shows that it still tracks the .pyc file and tries to add it as new file. See output below...

On branch master

Initial commit

Changes to be committed:

(use "git rm --cached ..." to unstage)

new file: .gitignore

new file: feedapp/init.py

new file: feedapp/appconfig.py

new file: feedapp/appconfig.pyc

System info: Win 7, cygwin

Note: This issue is CLEARLY not about the ignored file being already tracked. Also i tried both DOS and Unit style line ending on the .gitignore file.

git status:

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   .gitignore
#   new file:   feedapp/__init__.py
#   new file:   feedapp/appconfig.py
#   new file:   feedapp/appconfig.pyc

How do i troubleshoot this further?

I've a .gitignore file at the root of my repo. The .gitignore file has the following pattern to exclude the compiled python files and that is the only line in the file.

*.pyc

Now when i do the following at the root of the repo.

  1. git init
  2. git add .
  3. git status

It shows that it still tracks the .pyc file and tries to add it as new file. See output below...

On branch master

Initial commit

Changes to be committed:

(use "git rm --cached ..." to unstage)

new file: .gitignore

new file: feedapp/init.py

new file: feedapp/appconfig.py

new file: feedapp/appconfig.pyc

System info: Win 7, cygwin

Note: This issue is CLEARLY not about the ignored file being already tracked. Also i tried both DOS and Unit style line ending on the .gitignore file.

How do i troubleshoot this further?

I've a .gitignore file at the root of my repo. The .gitignore file has the following pattern to exclude the compiled python files and that is the only line in the file.

*.pyc

Now when i do the following at the root of the repo.

  1. git init
  2. git add .
  3. git status

It shows that it still tracks the .pyc file and tries to add it as new file. See output below...

System info: Win 7, cygwin

Note: This issue is CLEARLY not about the ignored file being already tracked. Also i tried both DOS and Unit style line ending on the .gitignore file.

git status:

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   .gitignore
#   new file:   feedapp/__init__.py
#   new file:   feedapp/appconfig.py
#   new file:   feedapp/appconfig.pyc

How do i troubleshoot this further?

Source Link
Gnu Engineer
  • 1.6k
  • 2
  • 14
  • 15
Loading