There exists a website which has its PHP/HTML/JS/CSS/etc files saved inside a Git repository.
We presently have 3 kinds of computer systems (or use cases) for that repository.
- Local developer: pull latest changes, make changes, invest in local repo, push to understand server
- Master server: central repository, all changes get pressed towards the master server
- Web server: changes are drawn lower in the master server when implementing the web site
So presently we:
local: git push origin master local: password: ******** local: ssh firstname.lastname@example.org webserver: password: ******** webserver: cd ~/domain.com/ webserver: git pull origin master
So my real question is: it is possible to method in which from the local computer I'm able to push straight to the net server?
local: git push origin master local: password: ******** local: git push webserver master local: password: ********
You actually can push straight to your webserver, however i wouldn't recommend it because you should only push to databases cloned using the --bare argument. I'd make use of the git hook system to allow the primary repository instantly update the repo on the internet server. Browse the publish-update hook in:
This script could consequently login to the net server via ssh and do
cd ~/domain.com/ git checkout master git pull origin master
By doing this you only have to concentrate on pushing towards the central server and do not have to worry about the net server, most commonly it is up-to-date when a push has been manufactured. If you're able to automate something, then automate it :)
I even found a pleasant article for you personally about signing in via ssh inside a script (should you must use password, this really is trivial if your ssh-key continues to be setup):
Hope this can help!
Consider the git web addresses part of http://www.kernel.org/pub/software/scm/git/docs/v18.104.22.168/git-push.html
which means you would try:
git push ssh://email@example.com/~admin/domain.com/ master
ADDED: I believe a part of what you're requesting is how you can have multiple remote databases.
git remote add webserver ssh://firstname.lastname@example.org/~admin/domain.com/
that enables you to definitely run:
git push origin master git push webserver master
I believe the feature you're searching for is referred to here: http://debuggable.com/posts/git-tip-auto-update-working-tree-via-post-receive-hook:49551efe-6414-4e86-aec6-544f4834cda3
local you can include the webserver like a remote, exactly like you would inflict other:
git remote add webserver admin@webserver:/path/to/repo.git/ # push only master branch by default git config remote.webserver.push master
Now whenever your prepared to push you can easily do:
git push webserver