π Overview
This guide helps you configure VSCode Remote SSH for Magento 2 development on a remote Linux (Red Hat) server.
What You Get
Full VSCode IDE on remote server
IntelliSense & PHP code navigation
Git UI + terminal workflow
GitHub Copilot / AI assistance
No file syncing, no SCP, no FTP
β Prerequisites
VSCode installed on Windows
SSH access to remote server
.ppk private key
PuTTYgen (comes with PuTTY / WinSCP)
π Step 1: Install Remote-SSH Extension
Open VSCode
Go to Extensions (Ctrl+Shift+X)
Search for Remote β SSH
Install Remote Development (by Microsoft)
π Step 2: Convert PPK to OpenSSH Format
VSCode uses OpenSSH, not .ppk.
β Using PuTTYgen (Recommended)
Open PuTTYgen
Click Load
Select your .ppk file
Example:
D:\Docs\yourppk.ppk
Go to Conversions β Export OpenSSH key
Save as:
C:\Users\YourName.ssh\yourppk
Create the .ssh folder if it doesnβt exist.
π Alternative (WSL / Git Bash)
puttygen yourppk.ppk -O private-openssh -o ~/.ssh/id_rsa
π Step 3: Fix SSH Key Permissions (Important)
Open PowerShell as Administrator:
cd $env:USERPROFILE.ssh
icacls yourppk /inheritance:r
icacls yourppk /grant:r "$($env:USERNAME):(R)"
βοΈ Step 4: Create SSH Config File
Create/edit:
C:\Users\YourName.ssh\config
Host
HostName
User
IdentityFile ~/.ssh/yourppk
ServerAliveInterval 60
ServerAliveCountMax 3
π Explanation
Host β Friendly alias
HostName β Server IP
User β SSH username
IdentityFile β OpenSSH key
ServerAlive* β Prevent idle disconnects
π§ͺ Step 5: Test SSH Connection
ssh -i $env:USERPROFILE.ssh\yourppk username@
If this works β continue.
π Step 6: Connect from VSCode
Press Ctrl+Shift+P
Select Remote-SSH: Connect to Host
Choose
Select Linux
Wait for VSCode Server installation
β³ First connection may take 2β3 minutes.
π Step 7: Open Magento Project
Open Folder
Navigate to Magento root:
/var/www/html/magento
Click OK
π§© Step 8: Install Extensions on Remote Server
Extensions must be installed again for SSH.
Recommended Magento stack:
PHP Intelephense
GitHub Copilot
GitLens
PHP Debug
Magento 2 Snippets
Click βInstall in SSH: rβ
π Step 9: Magento VSCode Optimization
Create .vscode/settings.json:
{
"php.suggest.basic": false,
"intelephense.files.exclude": [
"/vendor//Tests/",
"/pub/static/"
],
"files.watcherExclude": {
"/var/": true,
"/generated/": true,
"/pub/static/": true
},
"search.exclude": {
"/var": true,
"/generated": true,
"/pub/static": true
}
}
π Improves performance & IntelliSense accuracy.
π Working with Git in VSCode
πΉ UI Method (Fastest)
Bottom-left β Click branch name β Select branch
πΉ Command Palette
Git: Checkout to...
πΉ Terminal (Power User)
git fetch origin
git checkout develop
git pull origin develop
πΏ Common Git Scenarios
Checkout Remote Branch
git fetch origin
git checkout feature/contact-admin-order
Commit & Push
git add .
git commit -m "Add Google address autocomplete"
git push origin feature/contact-admin-order
π GitLens (Highly Recommended)
Features
Inline blame
File history
Branch comparison
Line-level history
Install β GitLens β Install in SSH
π€ Configure Git Identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Verify:
git config --list
π§± Magento-Specific Workflow
After switching branches:
composer install
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
π Troubleshooting
β SSH Connection Failed
Check IP / firewall
Verify permissions on SSH key
Test via PowerShell SSH
β VSCode Server Install Failed
Check disk space (df -h)
Check home directory permissions
View Remote-SSH Output
β Git Asking Password
Set SSH key for Git provider:
ssh-keygen -t rsa -b 4096
cat ~/.ssh/id_rsa.pub
π§ Best Practices
Always git pull before work
Use feature branches
Commit small & often
Clear Magento cache after changes
Use Developer mode
Monitor logs:
tail -f var/log/system.log
β¨οΈ Useful Shortcuts
Action Shortcut
Command Palette Ctrl+Shift+P
Terminal Ctrl+`
Git Panel Ctrl+Shift+G
Quick File Ctrl+P
Multi Cursor Alt+Click
π― Benefits of This Setup
β
Full IDE on server
β
AI-assisted Magento coding
β
Zero file syncing
β
Faster debugging
β
Production-ready workflow
π§Ύ Summary
You now have:
π Secure Remote SSH setup
π§ IntelliSense & AI Copilot
πΏ Integrated Git workflows
β‘ Magento-optimized VSCode
π Direct terminal access
This is the most efficient way to develop Magento 2 on a remote server.
Top comments (0)