{"id":18699,"date":"2026-02-22T14:37:07","date_gmt":"2026-02-22T14:37:07","guid":{"rendered":"https:\/\/ggservers.com\/knowledgebase\/?post_type=ht_kb&#038;p=18699"},"modified":"2026-02-22T14:37:10","modified_gmt":"2026-02-22T14:37:10","slug":"how-to-automatically-deploy-to-your-pterodactyl-server-using-github-actions-full-ci-cd-guide","status":"publish","type":"ht_kb","link":"https:\/\/ggservers.com\/knowledgebase\/article\/how-to-automatically-deploy-to-your-pterodactyl-server-using-github-actions-full-ci-cd-guide\/","title":{"rendered":"How to Automatically Deploy to Your Pterodactyl Server Using GitHub Actions (Full CI\/CD Guide)"},"content":{"rendered":"<p>Updating game server files manually via FTP is time-consuming and prone to human error. By leveraging <strong>GitHub Actions<\/strong>, you can implement a professional CI\/CD (Continuous Integration\/Continuous Deployment) pipeline that automatically syncs your repository changes to your <strong>Pterodactyl<\/strong> server every time you push code. This guide ensures your plugins, mods, and configurations stay updated with zero manual effort.<\/p>\n<h2 class=\"wp-block-heading\">Why Automate Your Server Deployment?<\/h2>\n<ul class=\"wp-block-list\">\n<li><strong>Efficiency:<\/strong> No more manual dragging-and-dropping files.<\/li>\n<li><strong>Consistency:<\/strong> Ensures the server always matches your <code>main<\/code> branch.<\/li>\n<li><strong>Security:<\/strong> Keeps your SFTP credentials encrypted within GitHub\u2019s infrastructure.<\/li>\n<li><strong>Version Control:<\/strong> Easily roll back to a previous server state by reverting a commit.<\/li>\n<\/ul>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n<p>Before you begin, ensure you have gathered your <strong>SFTP Details<\/strong> from the GGServers panel. You can find these under <strong>Settings \u2192 SFTP Details<\/strong> on your server dashboard. You will need:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Connection Address (Host)<\/strong><\/li>\n<li><strong>SFTP Port<\/strong> (Usually 2022)<\/li>\n<li><strong>Username<\/strong><\/li>\n<li><strong>Password<\/strong> (Your panel login password)<\/li>\n<\/ul>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n<h2 class=\"wp-block-heading\">Step 1: Configure GitHub Repository Secrets<\/h2>\n<p>Hardcoding passwords into your workflow files is a major security risk. Instead, use <strong>GitHub Secrets<\/strong> to encrypt your credentials.<\/p>\n<ol class=\"wp-block-list\">\n<li>Navigate to your GitHub repository.<\/li>\n<li>Click <strong>Settings<\/strong> \u2192 <strong>Secrets and variables<\/strong> \u2192 <strong>Actions<\/strong>.<\/li>\n<li>Click <strong>New repository secret<\/strong> for each of the following:<\/li>\n<\/ol>\n<figure class=\"wp-block-table\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th>Secret Name<\/th>\n<th>Description \/ Value<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>SFTP_HOST<\/code><\/td>\n<td>Your server&#8217;s Connection Address\/IP.<\/td>\n<\/tr>\n<tr>\n<td><code>SFTP_PORT<\/code><\/td>\n<td>Usually <code>2022<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>SFTP_USERNAME<\/code><\/td>\n<td>Your unique Pterodactyl SFTP username.<\/td>\n<\/tr>\n<tr>\n<td><code>SFTP_PASSWORD<\/code><\/td>\n<td>Your GGServers panel password.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n<h2 class=\"wp-block-heading\">Step 2: Create the Deployment Workflow<\/h2>\n<p>GitHub Actions uses <code>.yml<\/code> files to define automation. Create a new file in your repository at the following path: <code>.github\/workflows\/main.yml<\/code> and paste the code below:<\/p>\n<pre class=\"wp-block-code\"><code>name: Deploy to GGServers\n\non:\n  push:\n    branches:\n      - main  # Triggers deployment when you push to the main branch\n\njobs:\n  deploy:\n    name: SFTP Sync\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout Code\n        uses: actions\/checkout@v4\n\n      - name: Sync Files via LFTP\n        uses: pressidium\/lftp-mirror-action@v1\n        with:\n          host: ${{ secrets.SFTP_HOST }}\n          port: ${{ secrets.SFTP_PORT }}\n          user: ${{ secrets.SFTP_USERNAME }}\n          pass: ${{ secrets.SFTP_PASSWORD }}\n          localDir: \".\/\"        # Root of your GitHub repo\n          remoteDir: \"\/\"        # Root of your server files\n          options: \"--delete --verbose --exclude .git\/ --exclude .github\/\"<\/code><\/pre>\n<h3 class=\"wp-block-heading\">Key Parameters Explained:<\/h3>\n<ul class=\"wp-block-list\">\n<li><strong>&#8211;delete:<\/strong> This removes files on the server that are no longer in your GitHub repo. <em>Warning: Use carefully if you have server-generated logs or save files.<\/em><\/li>\n<li><strong>localDir\/remoteDir:<\/strong> Adjust these if you only want to sync specific folders, such as <code>\/plugins<\/code>.<\/li>\n<li><strong>exclude:<\/strong> Prevents Git-related files from being uploaded to your game server.<\/li>\n<\/ul>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n<h2 class=\"wp-block-heading\">Step 3: Advanced Optimization (Optional)<\/h2>\n<h3 class=\"wp-block-heading\">Automatic Server Restart<\/h3>\n<p>To apply changes (like plugin updates), you often need to restart the server. You can add a <code>curl<\/code> step to the end of your workflow to trigger the <strong>Pterodactyl API<\/strong>. Ensure you have generated a <strong>Client API Key<\/strong> in the panel settings first.<\/p>\n<pre class=\"wp-block-code\"><code>      - name: Restart Server\n        run: |\n          curl -X POST \"https:\/\/panel.ggservers.com\/api\/client\/servers\/YOUR_SERVER_ID\/power\" \\\n          -H \"Authorization: Bearer ${{ secrets.PTERO_API_KEY }}\" \\\n          -H \"Content-Type: application\/json\" \\\n          -H \"Accept: Application\/vnd.pterodactyl.v1+json\" \\\n          -d '{\"signal\": \"restart\"}'<\/code><\/pre>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n<h2 class=\"wp-block-heading\">Common Troubleshooting<\/h2>\n<ul class=\"wp-block-list\">\n<li><strong>Connection Refused:<\/strong> Double-check that your <code>SFTP_PORT<\/code> is set to 2022 and your <code>SFTP_HOST<\/code> is correct.<\/li>\n<li><strong>Permission Denied:<\/strong> Ensure your SFTP username matches the one found in the &#8220;Settings&#8221; tab of the panel.<\/li>\n<li><strong>Workflow Not Triggering:<\/strong> Ensure your file is located exactly at <code>.github\/workflows\/main.yml<\/code>.<\/li>\n<\/ul>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n<p>Take your server management to the next level with <strong><a href=\"https:\/\/ggservers.com\">GGServers<\/a><\/strong>. Our Pterodactyl-powered panels are fully compatible with modern CI\/CD workflows, providing the speed and reliability professional server owners demand.<\/p>\n<p>\ud83d\udd25 <strong>Ready for a performance upgrade?<\/strong> Use code <strong>KB30<\/strong> for 30% off your next game server at <a href=\"https:\/\/ggservers.com\">GGServers.com<\/a>.<\/p>\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon\"><strong>Need help with your deployment script or API settings? Contact our team at the <\/strong><a href=\"https:\/\/ggservers.com\/billing\/submitticket.php\">Support Portal<\/a><strong>. We are available 24\/7!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Updating game server files manually via FTP is time-consuming and prone to human error. By leveraging GitHub Actions, you can implement a professional CI\/CD (Continuous Integration\/Continuous Deployment) pipeline that automatically syncs your repository changes to your Pterodactyl server every time you push code. This guide ensures your plugins, mods, and&#8230;<\/p>\n","protected":false},"author":2,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"ht-kb-category":[28],"ht-kb-tag":[9583,9587,9589,2168,9598,9581,9594,9590,9592,9586,9599,9591,9585,9584,9597,9593,9588,9595,9596,9582],"class_list":["post-18699","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-pterodactyl","ht_kb_tag-automate-minecraft-plugins","ht_kb_tag-game-server-ci-cd","ht_kb_tag-game-server-development-workflow","ht_kb_tag-ggservers-automation","ht_kb_tag-ggservers-technical-guide","ht_kb_tag-github-actions-game-server","ht_kb_tag-github-actions-sftp-deploy","ht_kb_tag-github-secrets-sftp","ht_kb_tag-github-workflow-game-server","ht_kb_tag-lftp-mirror-action","ht_kb_tag-minecraft-server-ci-cd","ht_kb_tag-pterodactyl-api-restart","ht_kb_tag-pterodactyl-auto-update","ht_kb_tag-pterodactyl-automated-deployment","ht_kb_tag-pterodactyl-panel-automation","ht_kb_tag-pterodactyl-power-actions-api","ht_kb_tag-pterodactyl-sftp-sync","ht_kb_tag-rust-server-automation","ht_kb_tag-secure-game-server-updates","ht_kb_tag-sftp-deployment-github"],"acf":[],"_links":{"self":[{"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb\/18699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=18699"}],"version-history":[{"count":2,"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb\/18699\/revisions"}],"predecessor-version":[{"id":18701,"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb\/18699\/revisions\/18701"}],"wp:attachment":[{"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=18699"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb-category?post=18699"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ggservers.com\/knowledgebase\/wp-json\/wp\/v2\/ht-kb-tag?post=18699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}