Is it possible to deploy code from a Cloudways app to an empty git repository? I would like to know if it's possible as I'm currently using FTP (Filezilla) for that. I'm able to clone a live site to a staging site, but cannot deploy it to Github in order to work on the files on my local machine.
How to push code from Cloudways to Github
3.7k Views Asked by user3752231 AtThere are 3 best solutions below

First, you need to create a new repository on GitHub. Then, launch Cloudways SSH terminal (Server Management Panel > Master Credentials > Launch SSH Terminal) and paste your credentials. Now run these commands:
cd applications/xxxxxx/public_html. xxxxxx is a folder name.
git init
git add .
git checkout -b master
git commit -m "first commit"
If you see this message “Please tell me who you are”, then run these two commands
git config --global user.email "[email protected]" //
git config --global user.name "Your Name"
git remote add origin https://github.com/farhanayub/GitHub.git
git push origin master
Then insert GitHub username and password.
If you see any error then run the following and repeat the steps again.
rm -rf .git/
For your reference: https://www.cloudways.com/blog/wordpress-github/

First, create an empty repository on Github.com. Then log into your Cloudways dashboard, open your application and set up "Deployment via Git". When all that's done, open a command line application (eg. Terminal on Mac) and log in using your SSH credentials. Next up you'll be executing a handful of Git commands:
First, you need to turn your server code into a local repository, by running the git init
command in the public_html
directory. This creates a .git
subdirectory, which contains all of the necessary metadata for the new repository. Next you create a snapshot using git add .
, and then you use git commit -m "My Cloudways Repo"
to capture the state of the snapshot. My Cloudways Repo
is a message for this initial commit and can be anything. After that, set a new remote using git remote add origin [email protected]:username/name_of_repo.git
, this is the same address you've used to setup "Deployment via Git". Finally, you use git push origin master
to push the code to the remote Github server.
Summarized:
Using command line, navigate to your application folder: /home/master/applications/yourdomain.com/public_html
then execute the following commands (one by one so you can read the responses):
git init
git add .
git commit -m "My Second Repo Cloudways"
git remote add origin [email protected]:username/name_of_repo.git
git push origin master
You can learn more about git init
, git add
and git commit
here:
https://www.atlassian.com/git/tutorials/setting-up-a-repository https://www.cloudways.com/blog/wordpress-github/#create-repository-on-github
You should first make sure you can deploy your Cloudways application (that you have copied through filezilla locally) with Git, and pushed to a GitHub repo:
See "Deploy Code to Your Application Using Git".
Once your SSH access is setup, you can click "start deployment" to initiate the process. It will fetch the GitHub repo, and deploy it.
That means, to the question "Is it possible to deploy the code from a cloudways app to an empty git repository?": no, the publication process is the other way around.
That would involve:
The last step being: