2

I am trying to understand how git client server model works. But one thing is not clear for me when we push the files from the client machine in many sources it's said that the files are pushed to server machine. But when I searched for the pushed file on server they are not found. According to doumentation server's bare repository only used for colloborating multiple git users as common point. But, my question is when new git user wants to pull the project for the first time from where does the server serves it?

Please help me in understanding this concept. Thanks in advance.

Parashuram
  • 303
  • 2
  • 6
  • 19
  • 2
    The files are pushed and stored in the form of Git objects, same way they’re stored in the `.git` directory in the local repository you push from. – Ry- Oct 30 '18 at 04:42
  • "But when I searched for the pushed file on server they are not found." - seems a bit unclarified. For starters, if the file is "in" the repo (on any branch), how it's stored in only an implementation detail. Or what the "pushed file" just "not found" in the repo? (What is currently in the Working Copy has *no bearing* on the content of the repository.) – user2864740 Oct 30 '18 at 04:58
  • I want to know where(in which path) the pushed file gets stored on server, like bare repository or somewhere else(some other path)? – Parashuram Oct 30 '18 at 05:30
  • Git stores *commits* rather than files. The commits themselves *contain* files, but in a sense, there are no files at all, there are only commits. Extracting a commit, through Git's index, into a work-tree, is how you convert the stored commit to a set of files. – torek Oct 30 '18 at 16:43
  • fine, but are commits(files) are stored on server's bare repository? if yes in what form they are stored? and when we clone the repository to a client machine from where does the commits are fetched? – Parashuram Nov 01 '18 at 10:32

1 Answers1

2

I want to know where(in which path) the pushed file gets stored on server, like bare repository or somewhere else(some other path)?

A bare repo includes only the .git usual content and no working tree (which usually shows the actual files of a given commits)

The objects subfolder will include your files (blob) compressed, but also your trees and commits

https://git-scm.com/book/en/v2/images/data-model-3.png

Depending on the transfer protocol those pack files are transfered back to your own .git repo, and one commit is checkout in your repo working tree.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250