Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcialca/3816639 to your computer and use it in GitHub Desktop.
Save marcialca/3816639 to your computer and use it in GitHub Desktop.
Creating and Deploying using Git, Github and PHP
/** Creating and Deploying using Git, Github and PHP **/
Prerequisites:
Server: SSH Acces, PHP, Git
Local: SSH, Git
0.Create a PHP file in your project called "deploy.php" with this content: /*<?php `git pull`;*/
1. Create Your Github Repo
2. Go to your project folder and initiate a git repository
git init
3. Create a .gitignore file for any sensitive files in your project
4. Pull Your files (Specific and special cases may ocurr)
git add . //This will commit all your files, respecting your .gitignore file
5. Commit ALL of your changes and put your message so you don´t have to use VIM
git commit -am "Your Message"
6. Add your Github repo to your project repo
git add origin https://github.com/USER/REPO-NAME.git
7. Push your project to your repo
git push origin master
8. SSH in your server
ssh USER@PROJECT.com
9. Clone your Github Repo
git clone https://github.com/USER/REPO.git //I prefer using HTTP. It gives me less errors
10. Make sure all the files are there
git pull origin master //OPTIONAL
11. Go to your Github Repo > Admin > Service Hooks > WebHook URLS
12. Add this URL: http://project.com/route_to/deploy.php. > Update Settings
13. Make a test change in your local project. Commit your Changes to Github
git add .
git commit -am "Testing pull"
git push origin master
14. That will turn on the WebHook and execute a git pull and update your site
/** Creating and Deploying using Git, Github and PHP **/
Prerequisites:
Server: SSH Acces, PHP, Git
Local: SSH, Git
0.Create a PHP file in your project called "deploy.php" with this content: /*<?php `git pull`;*/
1. Create Your Github Repo
2. Go to your project folder and initiate a git repository
git init
3. Create a .gitignore file for any sensitive files in your project
4. Pull Your files (Specific and special cases may ocurr)
git add . //This will commit all your files, respecting your .gitignore file
5. Commit ALL of your changes and put your message so you don´t have to use VIM
git commit -am "Your Message"
6. Add your Github repo to your project repo
git add origin https://github.com/USER/REPO-NAME.git
7. Push your project to your repo
git push origin master
8. SSH in your server
ssh USER@PROJECT.com
9. Clone your Github Repo
git clone https://github.com/USER/REPO.git //I prefer using HTTP. It gives me less errors
10. Make sure all the files are there
git pull origin master //OPTIONAL
11. Go to your Github Repo > Admin > Service Hooks > WebHook URLS
12. Add this URL: http://project.com/route_to/deploy.php. > Update Settings
13. Make a test change in your local project. Commit your Changes to Github
git add .
git commit -am "Testing pull"
git push origin master
14. That will turn on the WebHook and execute a git pull and update your site
@silambarasannatesan
Copy link

hi , I think point no.6 should be updated to git remote add origin .... instead of git add origin

@codeparl
Copy link

Thanks

@faith-code-exe
Copy link

Thanks

@harshalmadgulkar
Copy link

hi , I think point no.6 should be updated to git remote add origin .... instead of git add origin

Can you help me in deploying php_sql?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment