On Jan 24, 2:25 am, gayleard <timothygayleardmur...@gmail.com> wrote:

> I have a project using Git on machine A.
> I'm running a Centos server on machine B.
> I'd like to "publish" the project on machine B
> (mainly for my own use, so I can access it from various sites).
> I don't plan to run git on machine B,
> except in so far as that is necessary to leave a master copy there.
> If so, how exactly do I create and populate the "public repository"?

On machine B:

1) Install minmal Git

2) Pick and create a directory for your project, say,
mkdir ~/devel/myrepo.git

3) Make it a bare repository:
cd ~/devel/myrepo.git
git init --bare

On machine A:

1) Add a named "remote" to your .git/config; the remote can be named
arbitrarily, but better stick to a "special" name "origin" because
it's what assumed by Git when no remote name is provided, so it can
save some typing in the future.
git remote add origin ssh://machineb/~/devel/myrepo.git
(if you log in to machine B as a different user, use 
2) Push your work to machine B:
git push --mirror

Basically, that's all you have to do.
The true story is that if you intend to push to this remote repo from
other machines and then pull from the machine A, you'll probably want
to make your current branches "track" the same named branchs in the
remote repo, as if you cloned your repo from the remote one.
To do this you first fetch the remote branches (no actual objects will
be copied) using
git fetch
and then add several sections to your .git/config files to make your
branches tracking, like this:
[branch "master"]
        remote = origin
        merge = refs/heads/master
You can also "recreate" your local branches from remote one to achieve
the same effect.
Say, to convert the master branch you do this:
git checkout -b newmaster origin/master
git branch -d master
git branch -m newmaster master

You can also opt not to mess with making the branches tracking, and
just clone the remote repo you created.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to