Thịnh Phạm
Thịnh Phạm

Reputation: 2663

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

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!

Upvotes: 4

Views: 3473

Answers (1)

Enrico Campidoglio
Enrico Campidoglio

Reputation: 59963

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

Upvotes: 17

Related Questions