wiltingrose
wiltingrose

Reputation: 11

How do I find the .git file in github?

All I have been using for my project is github. I don't know how to use git. For the life of me, I cannot figure out how to include the .git file when I download my project as a zip from github. It is important that it is included for my project. How do I make sure this is included?

All I can find in my .zip after downloading it is .gitignore

Upvotes: 0

Views: 3994

Answers (2)

CursedGoat
CursedGoat

Reputation: 81

Downloading a zip is the same as using the 'git archive' command really. It's a cleaned version of your app with none of the special metadata that makes it a repository.

If you want it to be a repository you can run git commands against, you CAN download the zip, extract it, git init the directory then set the upstream. However, if you just clone it instead of downloading a zip, your directory will already be a working repository.

Upvotes: 0

joshmeranda
joshmeranda

Reputation: 3251

The short answer is: you don't.

The .git directory is more or less a container for a bunch of metadata and local repository state tracking, which is read and written by the git command. Much of the information stored there is specific to each person's local repository or stores data relating to mulitple branches, making it impractical to store that data in the remote repo which is why even when running git add .git you won't see the directory staged for commit. THis answer gives a good overview of what is contained in the .git directory: What is the .git folder

When you download a repository as a zip from github, it can't assume that you are looking for a git repository so it doesn't include one. If you have downloaded the zip you can add the .git directory with git init. This is only so helpful since it isn't hooked up to a remote repo yet. You can add the remote with git remote add <remote name> <upstream url>.

However, all of this can be done by simply cloning the repo rather than downloading the zip.

Upvotes: 2

Related Questions