- Push to multiple locations for immediate reduntant backup.
- Accidental file deletions can be restored quickly.
- Code history is added.
- Option to use more IDEs like Atom or VSCode.
- Multiple developers can work on the same files.
- (OPTIONAL) Setup a private PHP server. LAMP, WAMP or MAMP are great local hosting solutions.
- Download git-fork (GIT client with GUI) and WinSCP (FTP client). Or, pick your own git and ftp client.
- Download PuTTY (if on Windows). Use PuTTYGen to generate a private/public key and a .ppk file on your workstation computer. Place files in the
%USERPROFILE%/.ssh
folder. - Go to cPanel and enable jail shell access on your account.
- Upload your private/public keys to
SSH Access > Manage SSH Keys
on your cPanel account. Also clickManage > Authorize
. - In cPanel click GIT. Toggle off the clone from URL option, and type in a git repo name and directory name.
- Use Putty and SSH in to your server to test if you can gain access, and press Y to accept the certificate. Ex:
ssh://[email protected]:22
- Now use git-fork to clone your repo into your private PHP server's public_html folder using
ssh://[email protected]:22/home/ACCOUNT/REPO_DIR
- Use WinSCP and SFTP in to your
public_html
directory and copy the files to your newly cloned local workstation repo directory. - Make a
.cpanel.yml
file (see above) in our git repo directory. This file will make our server make a copy of our updated files to ourpublic_html
directory. - At this point if you would like to make a second commit to a remote repo do it now with this tutorial.
- In git-fork stage our changed files, commit, and push them to the server(s).
At this point our files are now stored in a repo directory, and changes are sent to our public_html folder. We can also test our files prior to commit/push on our local server (step 1).
If you're using Windows and want to use your SSH key at all times for things like VSCode and Atom, I recommend setting up Pageant to start when your computer starts. To do this, open your %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
folder and make a batch file (see above).