
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
find-gitdir
Advanced tools
Find .git directory with support of submodules, --separate-git-dir and linked worktrees.
const gitdir = require('find-gitdir')
Let's say we have a git repository at /example and that this is our working directory. Its gitdir will commonly be at /example/.git.
await gitdir() // /example/.git
Let's also say we have a git submodule at ./beep. Then find-gitdir will find a symbolic link at ./beep/.git pointing to the gitdir ../.git/modules/beep:
await gitdir('./beep') // /example/.git/modules/beep
By default find-gitdir does not look in parent directories. It can be enabled:
await gitdir('./node_modules/find-gitdir') // null
await gitdir('./node_modules/find-gitdir', { roam: true }) // /example/.git
gitdir([cwd][, options][, callback])Yields an absolute path to a .git directory or null if not found, given working directory cwd which defaults to process.cwd(). If no callback if provided, a promise is returned. Options:
roam (boolean, default false): enable looking in parent directoriescommon (boolean, default false): if cwd is a linked worktree then return the gitdir of the main worktree (a.k.a. $GIT_COMMON_DIR) instead of the gitdir of the linked worktree. This can be useful if you need non-worktree files like config.If options is a boolean, it is interpreted as options.roam for backwards compatibility.
gitdir.sync([cwd][, options])Synchronous variant. Returns an absolute path or null.
With npm do:
npm install find-gitdir
MIT © Vincent Weevers
FAQs
Find .git directory with support of submodules and --separate-git-dir
The npm package find-gitdir receives a total of 810 weekly downloads. As such, find-gitdir popularity was classified as not popular.
We found that find-gitdir demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.