* git push from client is not updating files on server
@ 2012-03-06 16:52 Jerome Yanga
2012-03-06 17:46 ` Ben Tebulin
2012-03-06 21:12 ` Neal Kreitzinger
0 siblings, 2 replies; 15+ messages in thread
From: Jerome Yanga @ 2012-03-06 16:52 UTC (permalink / raw)
To: git
My main objective is to create a central public Git server. I had
followed the instructions in the URL below to make it public.
http://book.git-scm.com/4_setting_up_a_public_repository.html
>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
My push seems to be successful too using the command below as I get
the message "Everything up-to-date".
git push
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.
Help.
Regards,
j
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-06 16:52 git push from client is not updating files on server Jerome Yanga @ 2012-03-06 17:46 ` Ben Tebulin 2012-03-06 19:35 ` Junio C Hamano 2012-03-06 21:12 ` Neal Kreitzinger 1 sibling, 1 reply; 15+ messages in thread From: Ben Tebulin @ 2012-03-06 17:46 UTC (permalink / raw) To: git You can only push to "bare-only repositories". These do not contain a working tree but only a .git directory. You can only see changes changes in Git repository on the file system if you clone & pull this bare-only repository to a regular repository. It seems you looking for the wrong thing in the wrong place... Am 06.03.2012 17:52, schrieb Jerome Yanga: > My main objective is to create a central public Git server. > [...] > 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-06 17:46 ` Ben Tebulin @ 2012-03-06 19:35 ` Junio C Hamano [not found] ` <CAC0z1F-Eg2DOLvd3aA5XCoEJjj1jC=VWVkTA+uc24=18h3pN7g@mail.gmail.com> 0 siblings, 1 reply; 15+ messages in thread From: Junio C Hamano @ 2012-03-06 19:35 UTC (permalink / raw) To: Jerome Yanga; +Cc: git, Ben Tebulin [jc: resurrected JY as recipient] Ben Tebulin <nntp.20.jexpert@spamgourmet.com> writes: > You can only push to "bare-only repositories". These do not contain a > working tree but only a .git directory. That's a bit too strong. You do not have to limit your "push" into "bare repositories" (drop "-only", there is no such word), but it is perfectly fine to use "push" as a way to emulate a "fetch" that you would wish you could but you cannot in the opposite direction. What "push" does not do is to touch the working tree, and this is intuitively understandable once you realize that "push" is an opposite of "fetch". > My push seems to be successful too using the command below as I get > the message "Everything up-to-date". > > git push It is somewhat strange that this _succeeded_. When pushing into a repository with a working tree (i.e. "a non-bare repository") and especially when trying to update its current branch with such a push, "git push" would by default be refused, unless you tweak a configuration variable or two on the receiving end. That is an expert feature and I do not think that is being in use in this particular scenario, so perhaps the push did _not_ succeed to update the branch Jerome thought it updated, but instead updated a branch that is _not_ the one that is checked out in the repository on the receiving end of this push. ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <CAC0z1F-Eg2DOLvd3aA5XCoEJjj1jC=VWVkTA+uc24=18h3pN7g@mail.gmail.com>]
* Re: git push from client is not updating files on server [not found] ` <CAC0z1F-Eg2DOLvd3aA5XCoEJjj1jC=VWVkTA+uc24=18h3pN7g@mail.gmail.com> @ 2012-03-06 20:37 ` Junio C Hamano 0 siblings, 0 replies; 15+ messages in thread From: Junio C Hamano @ 2012-03-06 20:37 UTC (permalink / raw) To: Jerome Yanga; +Cc: git Jerome Yanga <jerome.yanga@gmail.com> writes: [jc: kicking the thread back to the list; I do not give free consultation in private, but I do not mind answering questions in public to help wider audience.] > Thank you for the prompt response. > > The projects in the Apache DocumentRoot are bare repositories. I > think this is what allowed me to push at least this is how I > understood it from the URL I had quoted in my last message. > > If I understood what you had said about push being the opposite of > fetch, then it is understandable that the files on the working > directory did not get updated and that it only shows in the Gitweb > interface. > > So how do I make the changes go in the working tree? By arranging a "checkout" to happen when you want to. One common way people seem to do this is to have "git reset --hard HEAD" in post update hook when the push came to the current branch, assuming that nobody but the update in response to "push" is expected to touch the working tree of the receiving repository. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-06 16:52 git push from client is not updating files on server Jerome Yanga 2012-03-06 17:46 ` Ben Tebulin @ 2012-03-06 21:12 ` Neal Kreitzinger 2012-03-06 21:21 ` Neal Kreitzinger 1 sibling, 1 reply; 15+ messages in thread From: Neal Kreitzinger @ 2012-03-06 21:12 UTC (permalink / raw) To: Jerome Yanga; +Cc: git On 3/6/2012 10:52 AM, Jerome Yanga wrote: > My main objective is to create a central public Git server. I had > followed the instructions in the URL below to make it public. > > http://book.git-scm.com/4_setting_up_a_public_repository.html > > 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 > > My push seems to be successful too using the command below as I get > the message "Everything up-to-date". > > git push > > 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. I suspect reviewing it in gitweb is sufficient to verify that the push did what you wanted. (I don't use gitwet, yet.) v/r, neal ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-06 21:12 ` Neal Kreitzinger @ 2012-03-06 21:21 ` Neal Kreitzinger [not found] ` <CAC0z1F_eyMo4D8E2j15dOFhp-6tZ_ixacB6XcKfNpJategcsXQ@mail.gmail.com> 0 siblings, 1 reply; 15+ messages in thread From: Neal Kreitzinger @ 2012-03-06 21:21 UTC (permalink / raw) Cc: Jerome Yanga, git On 3/6/2012 3:12 PM, Neal Kreitzinger wrote: > On 3/6/2012 10:52 AM, Jerome Yanga wrote: >> >> 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <CAC0z1F_eyMo4D8E2j15dOFhp-6tZ_ixacB6XcKfNpJategcsXQ@mail.gmail.com>]
[parent not found: <CAC0z1F_LYRkReO1qqcjkWy6Vb3E0_oNo-0kSf15nGfQFAtXpdg@mail.gmail.com>]
* Re: git push from client is not updating files on server [not found] ` <CAC0z1F_LYRkReO1qqcjkWy6Vb3E0_oNo-0kSf15nGfQFAtXpdg@mail.gmail.com> @ 2012-03-06 23:07 ` Jerome Yanga 2012-03-06 23:32 ` Neal Kreitzinger 0 siblings, 1 reply; 15+ messages in thread From: Jerome Yanga @ 2012-03-06 23:07 UTC (permalink / raw) To: Neal Kreitzinger; +Cc: git 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 <jerome.yanga@gmail.com> 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 <jerome.yanga@gmail.com> wrote: >> 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 <nkreitzinger@gmail.com> wrote: >>> On 3/6/2012 3:12 PM, Neal Kreitzinger wrote: >>>> >>>> On 3/6/2012 10:52 AM, Jerome Yanga wrote: >>>>> >>>>> >>>>> 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-06 23:07 ` Jerome Yanga @ 2012-03-06 23:32 ` Neal Kreitzinger 2012-03-07 0:28 ` Jerome Yanga 0 siblings, 1 reply; 15+ messages in thread From: Neal Kreitzinger @ 2012-03-06 23:32 UTC (permalink / raw) To: Jerome Yanga; +Cc: git On 3/6/2012 5:07 PM, Jerome Yanga wrote: > 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-06 23:32 ` Neal Kreitzinger @ 2012-03-07 0:28 ` Jerome Yanga 2012-03-07 1:11 ` Neal Kreitzinger ` (2 more replies) 0 siblings, 3 replies; 15+ messages in thread From: Jerome Yanga @ 2012-03-07 0:28 UTC (permalink / raw) To: Neal Kreitzinger; +Cc: git 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 <nkreitzinger@gmail.com> wrote: > On 3/6/2012 5:07 PM, Jerome Yanga wrote: >> >> 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-07 0:28 ` Jerome Yanga @ 2012-03-07 1:11 ` Neal Kreitzinger 2012-03-07 2:23 ` Junio C Hamano 2012-03-07 2:34 ` Neal Kreitzinger 2 siblings, 0 replies; 15+ messages in thread From: Neal Kreitzinger @ 2012-03-07 1:11 UTC (permalink / raw) To: Jerome Yanga; +Cc: git On 3/6/2012 6:28 PM, Jerome Yanga wrote: > 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-07 0:28 ` Jerome Yanga 2012-03-07 1:11 ` Neal Kreitzinger @ 2012-03-07 2:23 ` Junio C Hamano 2012-03-07 2:34 ` Neal Kreitzinger 2 siblings, 0 replies; 15+ messages in thread From: Junio C Hamano @ 2012-03-07 2:23 UTC (permalink / raw) To: Jerome Yanga; +Cc: Neal Kreitzinger, git Jerome Yanga <jerome.yanga@gmail.com> writes: > 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. So that <non-bare working directory> above is what you want to be updated when you update <project>.git? More concretely, for example, you have say /srv/project/frotz and /var/www/git/frotz.git directories on that server. Perhaps the project may have started in the former: mkdir -p /srv/project/frotz cd /srv/project/frotz git init ... populate with the sources ... git add ... git commit and then cloned to the other one cd /var/www/git && git clone --bare /srv/project/frotz frotz.git I'll assume that is more or less the set-up you have. Now, it depends on how the push goes to the latter one (I do not remember offhand if pushing over dumb http transport triggers hooks), but in general, you would install a post-update hook (read githooks manual page) in the latter repository, that gets triggered when it receives a push. The hook could do something like this: #!/bin/sh unset GIT_DIR cd /srv/project/frotz && git pull --ff-only /var/www/git/frotz.git master && : you can trigger automated test here if you want to && make test The above example goes to the repository with a working tree, pulls the latest change from the repository the user pushed into, and then runs the automated test. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-07 0:28 ` Jerome Yanga 2012-03-07 1:11 ` Neal Kreitzinger 2012-03-07 2:23 ` Junio C Hamano @ 2012-03-07 2:34 ` Neal Kreitzinger 2012-03-07 11:04 ` Holger Hellmuth 2 siblings, 1 reply; 15+ messages in thread From: Neal Kreitzinger @ 2012-03-07 2:34 UTC (permalink / raw) To: Jerome Yanga; +Cc: git On 3/6/2012 6:28 PM, Jerome Yanga wrote: > 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-07 2:34 ` Neal Kreitzinger @ 2012-03-07 11:04 ` Holger Hellmuth 2012-03-07 15:43 ` Jerome Yanga 0 siblings, 1 reply; 15+ messages in thread From: Holger Hellmuth @ 2012-03-07 11:04 UTC (permalink / raw) To: Neal Kreitzinger; +Cc: Jerome Yanga, git On 07.03.2012 03:34, Neal Kreitzinger wrote: > 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-07 11:04 ` Holger Hellmuth @ 2012-03-07 15:43 ` Jerome Yanga 2012-03-30 18:23 ` Jerome Yanga 0 siblings, 1 reply; 15+ messages in thread From: Jerome Yanga @ 2012-03-07 15:43 UTC (permalink / raw) To: Holger Hellmuth, Junio C Hamano, Neal Kreitzinger; +Cc: git 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 <hellmuth@ira.uka.de> wrote: > On 07.03.2012 03:34, Neal Kreitzinger wrote: >> >> 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. > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: git push from client is not updating files on server 2012-03-07 15:43 ` Jerome Yanga @ 2012-03-30 18:23 ` Jerome Yanga 0 siblings, 0 replies; 15+ messages in thread From: Jerome Yanga @ 2012-03-30 18:23 UTC (permalink / raw) To: Holger Hellmuth, Junio C Hamano, Neal Kreitzinger; +Cc: git 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 <jerome.yanga@gmail.com> 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 <hellmuth@ira.uka.de> wrote: >> On 07.03.2012 03:34, Neal Kreitzinger wrote: >>> >>> 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. >> >> ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2012-03-30 18:23 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-03-06 16:52 git push from client is not updating files on server Jerome Yanga 2012-03-06 17:46 ` Ben Tebulin 2012-03-06 19:35 ` Junio C Hamano [not found] ` <CAC0z1F-Eg2DOLvd3aA5XCoEJjj1jC=VWVkTA+uc24=18h3pN7g@mail.gmail.com> 2012-03-06 20:37 ` Junio C Hamano 2012-03-06 21:12 ` Neal Kreitzinger 2012-03-06 21:21 ` Neal Kreitzinger [not found] ` <CAC0z1F_eyMo4D8E2j15dOFhp-6tZ_ixacB6XcKfNpJategcsXQ@mail.gmail.com> [not found] ` <CAC0z1F_LYRkReO1qqcjkWy6Vb3E0_oNo-0kSf15nGfQFAtXpdg@mail.gmail.com> 2012-03-06 23:07 ` Jerome Yanga 2012-03-06 23:32 ` Neal Kreitzinger 2012-03-07 0:28 ` Jerome Yanga 2012-03-07 1:11 ` Neal Kreitzinger 2012-03-07 2:23 ` Junio C Hamano 2012-03-07 2:34 ` Neal Kreitzinger 2012-03-07 11:04 ` Holger Hellmuth 2012-03-07 15:43 ` Jerome Yanga 2012-03-30 18:23 ` Jerome Yanga
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).