3

How does one verify that files were pushed to a bare repository correctly? Since bare repositories have no working tree, you obviously can't do a simple git log because it isn't picked up as a git repo.

I realize there are solutions like suggested here, but I'd like to know how to do it using the command line.

2
  • Note that I'm not looking to see what is in it; simply that there is something in it (i.e. not an empty bare repo) Commented Mar 1, 2013 at 6:56
  • git log doesn't even look at the workspace, it should work just fine in a bare repository. Commented Mar 2, 2013 at 4:27

2 Answers 2

3

You could try and use git ls-remote:

 git ls-remote http://www.kernel.org/pub/scm/git/git.git # or, also a bare repo git ls-remote https://github.com/git/git 

As long as it doesn't return just the emtpy tree SHA1, that should mean there are commits in that upstream repo.

Sign up to request clarification or add additional context in comments.

1 Comment

Perfect! This worked perfectly. Note that this also works with ssh:// protocol URLs.
3

git log works just fine. Bare repositories are still recognized as repositories. Obviously. :)

git@koiru /var/git/repositories/sanpera.git $ ls total 37k -rw-r--r-- 1 git nogroup 1.2k Mar 1 06:00 FETCH_HEAD -rw-r--r-- 1 git nogroup 23 Sep 14 2011 HEAD drwxr-xr-x 2 git nogroup 4.1k Sep 14 2011 branches/ -rw------- 1 git nogroup 236 Jun 12 2012 config -rw-r--r-- 1 git nogroup 34 Jun 12 2012 description drwxr-xr-x 2 git nogroup 4.1k Jun 12 2012 hooks/ drwxr-xr-x 2 git nogroup 4.1k Sep 14 2011 info/ drwxr-xr-x 222 git nogroup 4.1k Sep 9 06:00 objects/ drwxr-xr-x 5 git nogroup 4.1k Oct 18 2011 refs/ git@koiru /var/git/repositories/sanpera.git $ git log commit a60f2ad3cc118eb7fd290be56448bcef82fe8252 Author: Eevee <[email protected]> Date: Sun Sep 2 18:22:50 2012 -0700 Stub a few more tests. ... 

4 Comments

I'm getting a fatal: bad default revision 'HEAD'
And yea, the "obviously" bit was a bit snarky. I should have worded that better ;)
having no HEAD sounds like a pretty good indication that you don't have any data. check the refs/heads directory; that lists all the branches. if it's empty, you got nothin'.
VonC's answer did show there was a correct branch. I had forgotten to pull all of the branches before I pushed back to another remote.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.