Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any personal information in the .git directory

Tags:

git

If I just want to send a whole source directory as a tar-ball to somebody, can I include the .git or is there any personal information in there?

The perfect scenario would be for the other person to unpack the directory and start there own fork, so to speak, without any trace of me as a former "owner" except for my name in the commits. Is that possible?

like image 320
steffen Avatar asked Nov 24 '15 15:11

steffen


2 Answers

Looking at the content of the .git/ directories, it contains all information needed to keep track of changes on the repo, which is useful for the person you are leaving a copy for, either for logs and commits that occurred before, so in short there are no personal information.

Although there is the case that @HBHB and @tarleb mentioned, which is configuring your username locally per repo, which leaves this info in your .git/config file as show below:

 [core]
     repositoryformatversion = 0
     fileMode = false
     bare = false
     logallrefupdates = true
     ignorecase = true
     precomposeunicode = true
 [branch "master"]
     remote = origin
     merge = refs/heads/master
 [branch "development"]
     remote = origin
     merge = refs/heads/development
 [user]
     email = {[email protected]}
like image 84
Rabea Avatar answered Nov 18 '22 08:11

Rabea


@RabeeAbdelWahab covers it pretty well above. Just to be a bit more specific: The .git directory contains info like

  • personal git preferences for this repo (e.g. email, GPG key fingerprint, sometimes even a SMTP password (bad idea!)),
  • your reflog history, including all recent commits even if they are no longer present in any branch,
  • local gitignore preferences (.git/info/exclude).

It's usually not super sensitive information, but one might want to think twice about whether it's a good idea to sent that to somebody else.

As an alternative, I'd suggest to clone the repo into a new directory, alter the settings you wanted to preserve and send that new repo instead.

like image 5
tarleb Avatar answered Nov 18 '22 07:11

tarleb