3

I'm brand new to git and am just starting to figure things out. I have been trying to figure out git on my remote dev server as well as my local machine. I have installed git successfully on both my remote server and my local machine (OSX). I am using a mac git client called Tower, here is my dilemma...

I can successfully create a bare repository on my remote server, no problems there. I then open up Tower and attempt to clone my remote repository to my local machine. I've been able to do that as well, I can successfully clone the remote repo to my local machine. However, whenever I add a new file to my local branch and then commit that change and push to the remote repo, it says it goes through successfully, but when I check my remote repo location, there are no new files there?

Tower says that the file exists in the remote repo, I can checkout that repo to a new local branch and it pulls the previous commit history and files like it should, but I can't find where the files are being stored on my remote repo.

What am I missing here? Any advice will be greatly appreciated, thanks!

skaffman
  • 398,947
  • 96
  • 818
  • 769
lewisqic
  • 1,943
  • 5
  • 21
  • 19

1 Answers1

3

They are being stored as Git objects. Bare repositories do not have a working directory, so there will never be any files checked out on the server. The data is stored in Git's own content-addressable filesystem under the objects directory, keyed by the SHA1 hash of the objects' contents. Objects include blobs (file data), trees (lists of files and trees), and commits (metadata such as author name, timestamp, commit message, parent commit object IDs, and the tree object ID that corresponds to the commit).

(The objects may also be combined into packs, which will live under the objects/pack directory.)

cdhowie
  • 158,093
  • 24
  • 286
  • 300
  • okay, that makes sense, so what is the best way to gain access to those unaccessible remote files so I can update a live website? Sorry if that sounds like a stupid question, complete noob here. – lewisqic Aug 28 '11 at 07:59
  • Clone the repository onto the web server, check out your production branch, and `git pull` whenever you need to update the live deployment to the latest code on the production branch. – cdhowie Aug 28 '11 at 08:01
  • maybe I'm missing something, but that seems kind of redundant for my purposes. Is it possible to simply push from my local computer to the live deployment without having to use a production branch? – lewisqic Aug 28 '11 at 08:04
  • 1
    You don't have to use a separate branch, but you cannot just push. Pushing does not update any checked-out files in the target repositories' working directory. You will still have to fiddle with the remote repository one way or another. The canonical way to deploy websites with Git is to clone the central repository onto the production server and pull updates. Pushing to the production repository is not a good idea. – cdhowie Aug 28 '11 at 08:06
  • got it, that makes perfect sense now. One more question... is there any other way to pull updates to the live server besides using the command line? – lewisqic Aug 28 '11 at 08:10
  • 1
    You could use a post-receive hook on the central repository to trigger a pull from the deployment repo. Or you could write a simple web application that will issue a pull when you click a button. It's up to you how you handle that. – cdhowie Aug 28 '11 at 08:12