Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to check in which directory i have installed git in linux

Mohsin_Ansari March 18, 2020

for example, I have installed git in the directory. But I'm not able to find in which directory I installed

1 answer

0 votes
Barry Allen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2020

In terminal, `which git` or `whereis git` will give your the git's executable file location. 

For example in my machine :

$which git

/usr/bin/git

$

Mohsin_Ansari March 21, 2020

Hi Allen, thanks for the answer. One more question. 

For example In an directory have initialized gitint and some files are getting track after few days again I came back and forgot the directory name

 Then I how I'll find this

Barry Allen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 21, 2020

Go to home directory and type the find . -name ".git" comment, it will list all the git repo in your computer. Check those list and find your repo.

 

$find . -name ".git"

Mohsin_Ansari March 22, 2020

find: ‘.-name’: No such file or directory

 

I'm getting this 

Barry Allen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 22, 2020

You need to give some space between "." "-name".

there are four part in this command and each part will be separated with space.

part1 = find (actual command)
part2 = . (dot means current directory)

part3= -name (command's args) 

part4= ".git" (file or directory name).

 

So the outcome is

$find . -name ".git"

$find(space).(space)-name(space)".git" #replace "(space)" with " "

Dhokia Rinidh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 27, 2023

Thank you so much, this has greatly helped me as well

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events