Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we get the source code from a .git folder of a project

Tags:

git

security

I have a question related to git and security.

Assume that someone has access to your .git folder of your project.

Will he be able, in some ways, to get the source code of the project from that?

If yes, how will he do that?

I'm curious.

Thanks!

like image 364
Thịnh Phạm Avatar asked Dec 14 '22 10:12

Thịnh Phạm


1 Answers

Absolutely. All they have to do is clone it:

git clone C:\Repo\.git Copy

The content of the .git directory is the repository with all its objects, references and packfiles.

Cloning the .git directory is no different than cloning any repository. In fact, you can create a so called bare repository and you would get the same contents that you usually see in the .git directory:

git init --bare C:\Repo
like image 166
Enrico Campidoglio Avatar answered Dec 28 '22 09:12

Enrico Campidoglio