git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* .env is not being ignored by this .gitignore file.
@ 2025-08-01 20:13 Skybuck Flying
  2025-08-01 20:24 ` Skybuck Flying
  2025-08-01 20:36 ` rsbecker
  0 siblings, 2 replies; 3+ messages in thread
From: Skybuck Flying @ 2025-08-01 20:13 UTC (permalink / raw)
  To: git@vger.kernel.org

Command line tool "Gemini cli" uses .env text files to store API keys.

I am trying to make git version 2.43.0.windows.1 ignore these .env files.

However for some reason it refuses to do so. (Any idea why ?)

Here is the .gitignore file:

# Modern Delphi 12.3 .gitignore
#
#-------------------------------------------------------------------------------
# Delphi / C++Builder Compiled Output & Binaries
#-------------------------------------------------------------------------------
*.exe
*.dll
*.so
*.a
*.lib
*.bpl
*.dcp
*.dcu
*.obj
*.o
*.res # Compiled resource files

#-------------------------------------------------------------------------------
# IDE Generated, User-Specific & Intermediate Files
#-------------------------------------------------------------------------------
*.~*
*.bak
*.old
*.tmp # General temporary files
*.temp # General temporary files
*.local
*.dsk
*.cfg
*.map
*.tds
*.drc
*.rsm
*.log
*.pch
*.ipch
*.stat
*.identcache
*.dproj.local
*.dproj.user
*.groupproj.local
*.groupproj.user
*.bkm # Delphi IDE bookmarks
*.tvsconfig # TestInsight configuration files
*.history # Files with .history extension

# Legacy project files
*.dof
*.kof

#-------------------------------------------------------------------------------
# IDE History, Recovery & Autosave
#-------------------------------------------------------------------------------
**/__history/
**/__recovery/
*.autosave

#-------------------------------------------------------------------------------
# Output Directories (using **/ to match at any depth)
#-------------------------------------------------------------------------------
**/Win32/
**/Win64/
**/Debug/
**/Release/

# Cross-platform output folders
**/Linux64/
**/OSX64/
**/OSXARM64/
**/Android/
**/Android64/
**/iOSDevice32/
**/iOSDevice64/
**/iOSSimulator/

#-------------------------------------------------------------------------------
# Common Temporary / Local / Sensitive Files (General)
#-------------------------------------------------------------------------------
*.zip # General compressed archives (often backups or downloads)
*.env # Environment variable files (CRITICAL for sensitive data)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: .env is not being ignored by this .gitignore file.
  2025-08-01 20:13 .env is not being ignored by this .gitignore file Skybuck Flying
@ 2025-08-01 20:24 ` Skybuck Flying
  2025-08-01 20:36 ` rsbecker
  1 sibling, 0 replies; 3+ messages in thread
From: Skybuck Flying @ 2025-08-01 20:24 UTC (permalink / raw)
  To: git@vger.kernel.org

Tested it once more in a new repo, issue confirmed.

As I suspected the problem seems to be with the comments at the end of the line (especially last line .env # problem comments)

To be on the safe side, .gitignore updated to place all comments on a separate line, this should solve the problem.

# Modern Delphi 12.3 .gitignore
#
#-------------------------------------------------------------------------------
# Delphi / C++Builder Compiled Output & Binaries
#-------------------------------------------------------------------------------
*.exe
*.dll
*.so
*.a
*.lib
*.bpl
*.dcp
*.dcu
*.obj
*.o

# Compiled resource files
*.res

#-------------------------------------------------------------------------------
# IDE Generated, User-Specific & Intermediate Files
#-------------------------------------------------------------------------------
*.~*
*.bak
*.old

# General temporary files
*.tmp

# General temporary files
*.temp

*.local
*.dsk
*.cfg
*.map
*.tds
*.drc
*.rsm
*.log
*.pch
*.ipch
*.stat
*.identcache
*.dproj.local
*.dproj.user
*.groupproj.local
*.groupproj.user

# Delphi IDE bookmarks
*.bkm

# TestInsight configuration files
*.tvsconfig

# Files with .history extension
*.history

# Legacy project files
*.dof
*.kof

#-------------------------------------------------------------------------------
# IDE History, Recovery & Autosave
#-------------------------------------------------------------------------------
**/__history/
**/__recovery/
*.autosave

#-------------------------------------------------------------------------------
# Output Directories (using **/ to match at any depth)
#-------------------------------------------------------------------------------
**/Win32/
**/Win64/
**/Debug/
**/Release/

# Cross-platform output folders
**/Linux64/
**/OSX64/
**/OSXARM64/
**/Android/
**/Android64/
**/iOSDevice32/
**/iOSDevice64/
**/iOSSimulator/

#-------------------------------------------------------------------------------
# Common Temporary / Local / Sensitive Files (General)
#-------------------------------------------------------------------------------
# General compressed archives (often backups or downloads)
*.zip

# Environment variable files (CRITICAL for sensitive data)
*.env

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: .env is not being ignored by this .gitignore file.
  2025-08-01 20:13 .env is not being ignored by this .gitignore file Skybuck Flying
  2025-08-01 20:24 ` Skybuck Flying
@ 2025-08-01 20:36 ` rsbecker
  1 sibling, 0 replies; 3+ messages in thread
From: rsbecker @ 2025-08-01 20:36 UTC (permalink / raw)
  To: 'Skybuck Flying', git

On August 1, 2025 4:14 PM Skybuck Flying wrote:
>Command line tool "Gemini cli" uses .env text files to store API keys.
>
>I am trying to make git version 2.43.0.windows.1 ignore these .env files.
>
>However for some reason it refuses to do so. (Any idea why ?)
>
>Here is the .gitignore file:
>
># Modern Delphi 12.3 .gitignore
>#
>#--------------------------------------------------------------------------
-----
># Delphi / C++Builder Compiled Output & Binaries
>#--------------------------------------------------------------------------
-----
>*.exe
>*.dll
>*.so
>*.a
>*.lib
>*.bpl
>*.dcp
>*.dcu
>*.obj
>*.o
>*.res # Compiled resource files
>
>#--------------------------------------------------------------------------
-----
># IDE Generated, User-Specific & Intermediate Files
>#--------------------------------------------------------------------------
-----
>*.~*
>*.bak
>*.old
>*.tmp # General temporary files
>*.temp # General temporary files
>*.local
>*.dsk
>*.cfg
>*.map
>*.tds
>*.drc
>*.rsm
>*.log
>*.pch
>*.ipch
>*.stat
>*.identcache
>*.dproj.local
>*.dproj.user
>*.groupproj.local
>*.groupproj.user
>*.bkm # Delphi IDE bookmarks
>*.tvsconfig # TestInsight configuration files *.history # Files with
.history extension
>
># Legacy project files
>*.dof
>*.kof
>
>#--------------------------------------------------------------------------
-----
># IDE History, Recovery & Autosave
>#--------------------------------------------------------------------------
-----
>**/__history/
>**/__recovery/
>*.autosave
>
>#--------------------------------------------------------------------------
-----
># Output Directories (using **/ to match at any depth)
>#--------------------------------------------------------------------------
-----
>**/Win32/
>**/Win64/
>**/Debug/
>**/Release/
>
># Cross-platform output folders
>**/Linux64/
>**/OSX64/
>**/OSXARM64/
>**/Android/
>**/Android64/
>**/iOSDevice32/
>**/iOSDevice64/
>**/iOSSimulator/
>
>#--------------------------------------------------------------------------
-----
># Common Temporary / Local / Sensitive Files (General)
>#--------------------------------------------------------------------------
-----
>*.zip # General compressed archives (often backups or downloads) *.env #
>Environment variable files (CRITICAL for sensitive data)=

It does not work when .gitignore contains
*.zip # Something
*.env # Something else

But does correctly for
*.zip
*.env

Try removing the comment or move it to the prior line. I am on git 2.45.1.

--Randall


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-01 20:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01 20:13 .env is not being ignored by this .gitignore file Skybuck Flying
2025-08-01 20:24 ` Skybuck Flying
2025-08-01 20:36 ` rsbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).