[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to create empty git with master / development branch ?



On 03/04/12 07:58, J. Bakshi wrote:
Dear list,

I need to create git repos on a remote server by the command executed on that server
through ssh as

` ` ` ` `
git --bare init project_name.git

` ` ` ` `

How can I also add the master branch, so that users don't need to
execute  [ git push origin master ]  ?

Thanks


I am not sure what you are trying to do, however, you seems to be confusing what is at the server with what a client, who clones from it is doing.

Having got a bare repository, you just push your existing local master branch to it

git push (repository url) master:master

That is what creates the master branch.

People can clone from it and in that case, they will get an origin branch that is mapped to this repositories master. I am not entirely sure, but I think they get setup with data in their .git/config file which allows them to just git push origin. If not you can easily add "names" where to push stuff to using the git remote command.

For instance, I use

git push public

on some of my repositories to push my local changes to both git hub AND a local repository (created just like you did) for my redmine instance to access. the .git/config file has something like the following in it

[remote "public"]
    url = github:akc42/MBBall.git
    url = hweb:redmine/git/mbball.git
    push = master:master
    push = sqlite:sqlite

In this case I am pushing TWO branches to TWO repositories. github: and hweb: are aliases for a more complicated URL that is set up inside .ssh/config - which in turn has the following in it

Host hweb
 HostName avalon.hartley-consultants.com
 User www-data
 IdentityFile ~/mydocs/PCinfo/keys/hartley-web/hartley_web
Host github
 HostName github.com
 User git
 IdentityFile ~/mydocs/PCinfo/keys/github/github_ssh_access




--
Alan Chandler
http://www.chandlerfamily.org.uk


Reply to: