Git-secret: .gitsecret folder is ignored. abort.

Created on 14 Sep 2017  路  12Comments  路  Source: sobolevn/git-secret

What are the steps to reproduce this issue?

Either in a new or existing repo run:
$ git secret init

What happens?

$ .gitsecret folder is ignored. abort.

Any logs, error output, etc?

No other error messages or logs

What versions of software are you using?

Operating system:
Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

git-secret path:
/usr/local/bin/git-secret

git-secret version:
0.2.2

Shell type and version:
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc.

gpg version:
gpg (GnuPG/MacGPG2) 2.0.30
libgcrypt 1.7.0

Most helpful comment

Just want to leave a solution here for those looking, I was getting this every time I tried to init git secret on a Windows machine (with WSL). The error was caused by my .gitignore file being in the wrong file format. I fixed it by using the dos2unix tool (apt install dos2unix) on my .gitignore file: dos2unix .gitignore. After that git secret init works fine.

All 12 comments

Could you please provide output of:

  • ls -alh from your base project folder
  • cat .gitignore

On a new repo:

$ mkdir test && cd test
$ git init
$ $ git secret init
.gitsecret folder is ignored. abort.
$ ls -alh
total 0
drwxr-xr-x 2 mashaklzo staff 68B 14 Sep 12:47 .
drwxr-xr-x 4 mashaklzo staff 136B 14 Sep 12:47 ..


$ cat .gitignore
cat: .gitignore: No such file or directory

In an existing repo, same issue

$ ls -alh
total 168
drwxr-xr-x  28 mashaklzo  staff   952B 14 Sep 12:35 .
drwxr-xr-x  25 mashaklzo  staff   850B 14 Sep 12:47 ..
-rw-r--r--   1 mashaklzo  staff   137B 14 Sep 12:35 .dockerignore
drwxr-xr-x  13 mashaklzo  staff   442B 14 Sep 12:35 .git
-rw-r--r--   1 mashaklzo  staff   1.1K 14 Sep 12:35 .gitignore
drwxr-xr-x   4 mashaklzo  staff   136B 14 Sep 12:35 .gitsecret
-rw-r--r--   1 mashaklzo  staff   171B 14 Sep 12:35 Dockerfile
-rw-r--r--   1 mashaklzo  staff   1.2K 14 Sep 12:35 Makefile
-rw-r--r--   1 mashaklzo  staff   1.4K 14 Sep 12:35 README.md
drwxr-xr-x  26 mashaklzo  staff   884B 14 Sep 12:35 tests

$ cat .gitignore

# git-secret files
env.development
env.testing

# pyenv
.python-version

# dotenv
.env

# virtualenv
venv/
ENV/

Do you have any global .gitignore settings?

Seems not, I have no results for

$ git config --get core.excludesfile

Although I get

$ less ~/.config/git/ignore
# Automatically created by GitHub for Mac
# To make edits, delete these initial comments, or else your changes may be lost!

*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

Sorry for the multiple questions, by what does git check-ignore -v .gitsecret return?

I get nothing back:

$ git check-ignore -v .gitsecret
mashaklzo:test mashaklzo $

No problem on the multiple questions, happy to troubleshoot.

This seems very strange. So, it says that .gitsecret/ is ignored.
Here's where this check is done:
https://github.com/sobolevn/git-secret/blob/master/src/main.sh#L14

Then it executes this function:
https://github.com/sobolevn/git-secret/blob/c85d482ec6143b710511a7b081ddb77b8887d79f/src/_utils/_git_secret_tools.sh#L335-L347

Maybe the reason is it checks for _check_ignore "${_SECRETS_DIR}/"?
There was a pull-request recently which fixed this line: https://github.com/sobolevn/git-secret/pull/103

Yes definitely strange - testing for an ignored file works as expected.

$ git check-ignore -v ".AppleDouble"
.gitignore:34:.AppleDouble  .AppleDouble

Aha, #103 fixed it. I applied the changes in the commit and it's working now. Thanks!

Just want to leave a solution here for those looking, I was getting this every time I tried to init git secret on a Windows machine (with WSL). The error was caused by my .gitignore file being in the wrong file format. I fixed it by using the dos2unix tool (apt install dos2unix) on my .gitignore file: dos2unix .gitignore. After that git secret init works fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  8Comments

alumarcu picture alumarcu  路  3Comments

tonyskapunk picture tonyskapunk  路  5Comments

learsix picture learsix  路  6Comments

joshrabinowitz picture joshrabinowitz  路  4Comments