How to find the path of the local git repository when I am possibly in a subdirectory - Stack Overflow

PHOTO EMBED

Thu Jun 04 2020 19:50:21 GMT+0000 (Coordinated Universal Time)

Saved by @hoangthienan95 #bash

git rev-parse --show-toplevel

could be enough if executed within a git repo.
From git rev-parse man page:

--show-toplevel
content_copyCOPY

https://stackoverflow.com/questions/12293944/how-to-find-the-path-of-the-local-git-repository-when-i-am-possibly-in-a-subdire