Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kennyendowed/9f731d5f91c5a0d870a2559b8e49b8f3 to your computer and use it in GitHub Desktop.
Save kennyendowed/9f731d5f91c5a0d870a2559b8e49b8f3 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 [email protected]
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 [email protected]
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment