Is there a way to make git write to the working directory of the
central public server?
Please be nice to the newbee. I am merely learning Git.
Regards,
j
On Tue, Mar 6, 2012 at 3:05 PM, Jerome Yanga [off-list ref] wrote:
Please be nice to the newbee. I am merely learning Git.
Regards,
j
On Tue, Mar 6, 2012 at 3:02 PM, Jerome Yanga [off-list ref] wrote:
quoted
Is there a way to make git write to the working directory of the
central public server?
Regards,
j
On Tue, Mar 6, 2012 at 1:21 PM, Neal Kreitzinger [off-list ref] wrote:
quoted
On 3/6/2012 3:12 PM, Neal Kreitzinger wrote:
quoted
On 3/6/2012 10:52 AM, Jerome Yanga wrote:
quoted
However, when I log into the central public Git server and look at
the files in the project, none of them have change. I can only see
the changes from the client via Gitweb.
Gitweb and gitk know how to look at .git (bare) repo and display the
contents. (I use gitk to verify that a push did what I wanted.) There is
no work-tree for a .git repo to do linux "ls" on. If you really want to
use commandline you would have to use git commands like git-show,
git-ls-files, git-cat-file, git-log, etc., to display and interrogate
the contents of git objects (tags, commits, trees, blobs) in a .git repo.
scratch git-ls-files from that list. Its not much use for bare repos,
either.
v/r,
neal
Is there a way to make git write to the working directory of the
central public server?
In your original post you stated:
> From the git client server, I can successfully clone projects in from
> the central public Git server using the command below.
>
> git clone
http://<hostname_of_central_public_git_server>/<Project_name>.git
".git" extension implies "bare" repo. A bare repo has _no_ working
tree. Is the repo in question bare or non-bare? If you are not sure,
then cd to the central-repo-dir (ie., the <Project_name>.git you cloned
_from_ in your example above) and run "git config -l |grep bare". If it
says "core.bare=true" then it is a bare repo.
v/r,
neal
The project in Apache's DocumentRoot was created using the following command:
"cd /var/www/git
git clone --bare <non-bare working directory> <project>.git"
Hence, I believe that is is bare. Besides, it does not have .git
folder. I assumed that when I did this that the non-bare directory
will also be updated when a push is performed via http.
My objective is that I would like the developers to be able to push
via http and these pushes will need to be reflected on the non-bare
working directory as these directories will be used for automated
tests.
Is what I am trying to do even possible? If so, please share with me a guide.
Thank you in advance.
Regards,
j
On Tue, Mar 6, 2012 at 3:32 PM, Neal Kreitzinger [off-list ref] wrote:
On 3/6/2012 5:07 PM, Jerome Yanga wrote:
quoted
Is there a way to make git write to the working directory of the
central public server?
In your original post you stated:
quoted
From the git client server, I can successfully clone projects in from
the central public Git server using the command below.
git clone
http://<hostname_of_central_public_git_server>/<Project_name>.git
".git" extension implies "bare" repo. A bare repo has _no_ working tree.
Is the repo in question bare or non-bare? If you are not sure, then cd to
the central-repo-dir (ie., the <Project_name>.git you cloned _from_ in your
example above) and run "git config -l |grep bare". If it says
"core.bare=true" then it is a bare repo.
v/r,
neal
The project in Apache's DocumentRoot was created using the following command:
"cd /var/www/git
git clone --bare<non-bare working directory> <project>.git"
I have a comment on the above command. Did you run:
git clone --bare /non-bare/working/directory project.git
(or)
git clone --bare file:///non-bare/working/directory project.git
because the former does hardlinks and the latter does a full copy (see
git-clone manpage section "GIT URLS"). I'm not sure how much it
matters, but you should confirm whether what you did is what you want.
v/r,
neal
The project in Apache's DocumentRoot was created using the following command:
"cd /var/www/git
git clone --bare<non-bare working directory> <project>.git"
Hence, I believe that is is bare. Besides, it does not have .git
folder.
The bare repo is the .git folder. That's why its called barerepo.git.
.git = git repo. worktree/.git = non-bare repo with worktree and .git
repo. barerepo.git = bare repo and no worktree.
I assumed that when I did this that the non-bare directory
will also be updated when a push is performed via http.
The non-bare you cloned from is independent. It doesn't know about the
bare repo you cloned from it, and your bare repo does not know about the
non-bare repo it was cloned from. I'm not sure what you were doing with
that non-bare before you created the bare from it. You may not need
that non-bare anymore if that's all it was for.
My objective is that I would like the developers to be able to push
via http and these pushes will need to be reflected on the non-bare
working directory as these directories will be used for automated
tests.
Create a new non-bare clone of your bare repo. Then do git-pull on the
new non-bare after the bare gets updates (someone does git push to it)
and you want to test those new commits. The worktree of the new
non-bare clone can be the document root of your testing virtual host, if
that's what you're doing. That way, you know that no one else is
messing with new non-bare (test repo) like doing development in it and
messing up your tests.
v/r,
neal
Create a new non-bare clone of your bare repo. Then do git-pull on the
new non-bare after the bare gets updates (someone does git push to it)
and you want to test those new commits. The worktree of the new non-bare
clone can be the document root of your testing virtual host, if that's
what you're doing. That way, you know that no one else is messing with
new non-bare (test repo) like doing development in it and messing up
your tests.
To expand on Neals method, if you do git fetch (periodically in a cron
job for example) on the cloned non-bare, 'git log HEAD..origin/HEAD'
will have output only if the non-bare has new commits.
Thank you all for the recommendations. I will try them.
I would like to confirm some info.
Junio,
Your assumption of my setup correct. I shall read on post-update
hook. If you have a recommended link for it, please share it.
Neal,
You are also correct. My current configuration's reaction to a push
shows that the bare repo that was cloned from a non-bare repo are
independent of each other. I will also try your recommendation.
Holger,
Thank you for explaining what Neal meant.
Regards,
j
On Wed, Mar 7, 2012 at 3:04 AM, Holger Hellmuth [off-list ref] wrote:
On 07.03.2012 03:34, Neal Kreitzinger wrote:
quoted
Create a new non-bare clone of your bare repo. Then do git-pull on the
new non-bare after the bare gets updates (someone does git push to it)
and you want to test those new commits. The worktree of the new non-bare
clone can be the document root of your testing virtual host, if that's
what you're doing. That way, you know that no one else is messing with
new non-bare (test repo) like doing development in it and messing up
your tests.
To expand on Neals method, if you do git fetch (periodically in a cron job
for example) on the cloned non-bare, 'git log HEAD..origin/HEAD' will have
output only if the non-bare has new commits.
I finally got the chance to implement your suggestions. I have
combined them and am very happy with the outcome. The missing pieces
for being able to push via Apache are as follows:
01) git config --global http.receivepack true (thanks Junio...found
this under githooks)
02) chown -R apache:apache /var/www/git
On the other hand, I have also implemented a non-bare repo for testing
(thanks Neal and Holger) by cloning the bare repo.
I hope that this helps another. ;)
Regards,
j
On Wed, Mar 7, 2012 at 7:43 AM, Jerome Yanga [off-list ref] wrote:
Thank you all for the recommendations. I will try them.
I would like to confirm some info.
Junio,
Your assumption of my setup correct. I shall read on post-update
hook. If you have a recommended link for it, please share it.
Neal,
You are also correct. My current configuration's reaction to a push
shows that the bare repo that was cloned from a non-bare repo are
independent of each other. I will also try your recommendation.
Holger,
Thank you for explaining what Neal meant.
Regards,
j
On Wed, Mar 7, 2012 at 3:04 AM, Holger Hellmuth [off-list ref] wrote:
quoted
On 07.03.2012 03:34, Neal Kreitzinger wrote:
quoted
Create a new non-bare clone of your bare repo. Then do git-pull on the
new non-bare after the bare gets updates (someone does git push to it)
and you want to test those new commits. The worktree of the new non-bare
clone can be the document root of your testing virtual host, if that's
what you're doing. That way, you know that no one else is messing with
new non-bare (test repo) like doing development in it and messing up
your tests.
To expand on Neals method, if you do git fetch (periodically in a cron job
for example) on the cloned non-bare, 'git log HEAD..origin/HEAD' will have
output only if the non-bare has new commits.