npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npmignore: .git directory included when a remote has a branch named 'changelog'

What I Wanted to Do

My git versioned project has an .npmignore file, and a remote I added has a branch named “changelog”. I wanted to use npm publish to publish a package without a .git/ directory.

What Happened Instead

npm publish published a package which included a .git/ directory. According to the documentation, this should not have happened.

Reproduction Steps

git clone git://
cd ol-mapbox-style
git remote add ahocevar git://
git fetch ahocevar
git checkout v4.3.0
npm install
npm pack

You’ll see that the build includes a .git/ folder with two files:

npm notice 151B    .git/logs/refs/remotes/ahocevar/changelog
npm notice 41B     .git/refs/remotes/ahocevar/changelog   

These files should not be there. Note that without the remote with a “changelog” branch, everything works as expected and documented.

Platform Info

$ npm --versions
{ 'ol-mapbox-style': '4.3.0',
  npm: '6.9.0',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.14.1',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform