How to initialize a master branch for new repo

2,963 views
Skip to first unread message

Mário Neto

unread,
Sep 24, 2011, 10:28:29 AM9/24/11
to gitolite
Hi,

I am having what seems to me a strange behavior. I have created a new
repo by adding it to conf/gitolite.conf, commited and pushed.

I get the message below

Initialized empty Git repository in /home/git/repositories/myrepo.git/

When I try to clone I receive

warning: You appear to have cloned an empty repository.

And I have to git push origin master to create the master branch.

Is there a way to to this automatically when the repo is created?

Some IDEs like Netbeans does not allow me to clone if I don't specify
a branch.

Regards.

Sitaram Chamarty

unread,
Sep 24, 2011, 10:39:45 AM9/24/11
to Mário Neto, gitolite
If normal git over ssh, using "git init --bare" on the server, does
something different, let me know. Until then it's not a gitolite
problem.

regards

sitaram

--
Sitaram

Mario De Mello Bittencourt Neto

unread,
Sep 26, 2011, 4:59:42 PM9/26/11
to Sitaram Chamarty, gitolite
Hi,

Where do you want me to use that "git init --bare" ?  In gitolite's home dir?

Well when I committed the gitolite.conf I got (added a repository named crystal)

remote: creating crystal...
remote: Initialized empty Git repository in /home/git/repositories/crystal.git/
To git@cvs:gitolite-admin
   bc76365..bcf0057  master -> master


When I cloned I got
warning: You appear to have cloned an empty repository.

Again, after these steps everything is normal AFAIK.

touch README 
git add README 
git commit README 
[master (root-commit) 6dbbbad] Initializing repository
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 README
git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 245 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To g...@myserver.com.br:crystal
 * [new branch]      master -> master

milk

unread,
Sep 26, 2011, 5:47:25 PM9/26/11
to Mario De Mello Bittencourt Neto, Sitaram Chamarty, gitolite

This sounds very familiar to the steps requested by github. While you
create a new repo via the github web interface, github asks that you
make an initial commit with a README.

-milki

Javier Domingo

unread,
Sep 26, 2011, 5:49:48 PM9/26/11
to Mario De Mello Bittencourt Neto, gitolite, Sitaram Chamarty

Mario,

As git doesn't know what branch you want to use, ha cannot write anything that you didn't want.

By the way, if you want, you can make gitolite do those initial commands. You can edit the git --bare command to do what you want. Obviosly not the git --bare, just make an script and call it.

Maybe sitaram knows another way

Sitaram Chamarty

unread,
Sep 26, 2011, 7:37:25 PM9/26/11
to Mario De Mello Bittencourt Neto, gitolite
On Tue, Sep 27, 2011 at 2:29 AM, Mario De Mello Bittencourt Neto
<mn...@argo.net.br> wrote:
> Hi,
> Where do you want me to use that "git init --bare" ?  In gitolite's home
> dir?

What I meant was, *without* using gitolite, just using a repo on some
user you have ssh access to.

Gitolite is just an access control layer. Gitolite does not and will
not change the behaviour of git *except* to allow/deny as rules
specify. It cannot and will not change the *content*, add dummy
commits, create branches, etc. If your NetBeans cannot deal with an
empty repo that is *not* gitolite's problem.

Sorry. Deal with it yourself; make a README file, add/commit/push
from a command line, *then* tell your IDE about the repo.

sitaram

--
Sitaram

Mario de Mello Bittencourt Neto

unread,
Sep 26, 2011, 9:30:14 PM9/26/11
to Sitaram Chamarty, gitolite
Hi,

I just thought that when gitolite creates a repo (after I push the conf with a new repo line) it should make this initial commit to create the master branch.

I'll probably have to locate where it creates and use it with this --bare option that you've told me.

Sitaram Chamarty

unread,
Sep 26, 2011, 9:38:49 PM9/26/11
to Mario de Mello Bittencourt Neto, gitolite
On Tue, Sep 27, 2011 at 7:00 AM, Mario de Mello Bittencourt Neto
<mn...@argo.net.br> wrote:
> Hi,
>

> I just thought that when gitolite creates a repo (after I push the conf with a new repo line) it should make this initial commit to create the master branch.

Well not everyone has an IDE that can't deal with empty repos. Most
IDEs probably work fine.

Even if that were true, why should gitolite change *git*'s behaviour
in aspects that do not have anything to do with access
control/administration, i.e., in terms of *content* of the repo?

> I'll probably have to locate where it creates and use it with this --bare option that you've told me.

Or you could use a gl-post-init hook --
http://sitaramc.github.com/gitolite/doc/2-admin.html#_gl_post_init_hook

--
Sitaram

Reply all
Reply to author
Forward
0 new messages