on a remote server i have a rails 3 app. i understand that i cannot push changes to a non bare repository. so,
- on the production machine, in the rails root directory, i created a directory named ‘.git’
- cd into the new .git directory
- ran git init –bare
- then from my development machine entered this command: git push ssh://jay@domain.com:12345/home/jay/public_html/domain/.git master:master
The push seemed successful because i got this msg:
Counting objects: 235, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (214/214), done.
Writing objects: 100% (235/235), 399.79 KiB, done.
Total 235 (delta 44), reused 0 (delta 0)
To ssh://jay@domain.com:12345/home/jay/public_html/domain/.git
* [new branch] master -> master
changes were made in the bare ‘.git’ directory but no changes were made to the remote production machine code. Is there another command that i need to run after pushing the changes?
UPDATE: I am the only developer. There are only two repositories.
1. on my development machine i installed git and then ran init, add and commit
2. on my remote production server i installed git and performed the the steps above
I think you are looking for something like having git-hook – post-receive hook to be specific – in your bare repo that will push to other repo which is the “remote production machine code”
First of all, dont create a
.gitdirectory. Just do agit init --barein the directory where you want the git repo. This need not be inpublic_html. Now in yourpublic_html\domainclone the other bare repo. Now you have your production code. Setup a post-receive hook in the bare repo’shooksfolder and have that push to the other repo inpublic_html. ( you may need to add a remote to the other repo ). This way, when you push from your development machine, the production code gets updated as well.You can add a remote to the code repo with
git remote add prod /home/jay/public_html/domain. With that setup, you can have your post-receive hook dogit push prod master