How I Push Single Files to My VPS Using PowerShell (Without Git Pull Every Time)
I am not a traditional coder. Most of my development journey is happening through AI tools like Anthropic Claude Code and OpenAI Codex.
Many times, I just explain what I want, and AI guides me with commands, fixes, and debugging steps.
But when you are learning like this, small issues can waste hours.
One issue I faced was very strange.
Whenever I pushed some files from my Windows PC to my VPS, symbols and text sometimes became broken. Instead of proper characters, I started seeing:
???
Especially in special symbols, formatted text, or sometimes Hindi content.
At first, I thought maybe my VPS was broken, or Claude Code generated something wrong. But after debugging with Claude Code only, I learned it was actually an encoding issue in PowerShell that happen when we push local files to VPS.
So now, before pushing files through SSH, I first run this code in Windows Powershell or Command Prompt:
$OutputEncoding = [System.Text.UTF8Encoding]::new($false)
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
This forces PowerShell to use UTF-8 properly and avoids corrupted characters while sending content.
After that, I push a single file directly from my local system to the VPS using this command in Windows Command Prompt or Powershell:
Get-Content "D:\projects\myapp\frontend\src\App.js" -Raw -Encoding UTF8 | ssh root@123.123.123.123 "cat > /opt/myapp/frontend/src/App.js"
What this command basically does:
Reads the local file from your PC
Sends its content through SSH
Replaces the file directly on the VPS
For beginners or vibe coders, this feels much easier than rebuilding or uploading the whole project every time.
Why I personally like this method:
Very fast for small fixes
No need for full deployment
Useful when only one file changed
Easy to understand compared to complex DevOps pipelines
Works nicely when AI tools are helping you debug live issues
One important thing:
I have hidden my real project folders, server IP, and actual app names in the example above for security reasons. Never expose your real VPS IP or sensitive folder structure publicly in blogs or screenshots.
Honestly, many things in my journey are still trial and error. Sometimes Claude Code suggests one thing, Codex suggests another, and I test both until something works. But small tricks like this save a lot of time when you are building apps without deep coding knowledge.

Comments
Post a Comment