112 lines
3.5 KiB
Markdown
112 lines
3.5 KiB
Markdown
# **The Complete Guide: Local and Remote Git Workflow**
|
|
|
|
This guide walks through the exact operational process used to create, configure, sync, and push a repository named **hollywood** between your local development machine and a self-hosted Oracle VPS.
|
|
|
|
## **Part 1: Server-Side Preparation (Oracle VPS)**
|
|
|
|
Before your local machine can push code anywhere, the destination bare database must exist on the remote server.
|
|
|
|
### **1\. Connect via your SSH Shortcut**
|
|
|
|
Instead of typing out long IP addresses, use the custom alias configured in your \~/.ssh/config file:
|
|
|
|
ssh oracle
|
|
|
|
### **2\. Create the Bare Repository Vault**
|
|
|
|
On the remote server, create a dedicated directory ending in .git inside the git user's home directory and initialize it as a bare repository (meaning it holds only version history without an active working directory):
|
|
|
|
mkdir \~/hollywood.git
|
|
cd \~/hollywood.git
|
|
git init \--bare
|
|
exit
|
|
|
|
## **Part 2: Local Machine Setup (Windows / PowerShell)**
|
|
|
|
Now, configure your local workspace so it knows how to securely talk to your private server without hardcoding keys or raw IP addresses every time.
|
|
|
|
### **1\. Configure Global Git Identity**
|
|
|
|
Ensure your commits are properly attributed to your developer profile:
|
|
|
|
git config \--global user.name "Your Name"
|
|
git config \--global user.email "your.email@example.com"
|
|
|
|
### **2\. Set Up the Windows SSH Config File**
|
|
|
|
On your Windows machine, ensure your C:\\Users\\medic\\.ssh\\config file contains your connection details (without any file extension):
|
|
|
|
Host oracle
|
|
HostName 129.213.172.214
|
|
User git
|
|
IdentityFile C:\\Users\\medic\\.ssh\\ssh-key-2026-08-06.key
|
|
|
|
## **Part 3: Creating and Linking a Local Project**
|
|
|
|
If you are starting a brand new project or linking an existing local folder to your Oracle vault:
|
|
|
|
### **1\. Navigate to Your Project Workspace**
|
|
|
|
cd C:\\000\\00-vaults\\00-hollywood
|
|
|
|
### **2\. Initialize Git (If it's a brand new project)**
|
|
|
|
git init
|
|
|
|
### **3\. Link Your Remote Server Vault**
|
|
|
|
Point the local origin nickname to your Oracle alias and bare repo path:
|
|
|
|
git remote add origin oracle:da_new_shit.git
|
|
|
|
*(Note: If you ever need to check where origin is pointing, run git remote \-v)*
|
|
|
|
## **Part 4: Daily Workflow — Pushing and Pulling**
|
|
|
|
Once your project is linked, managing updates follows a clean, reliable loop.
|
|
|
|
### **1\. Saving Local Changes to the Server**
|
|
|
|
When you edit files locally and want to sync them to your Oracle vault:
|
|
|
|
\# Stage all modified files
|
|
git add .
|
|
|
|
\# Commit changes with a clear message
|
|
git commit \-m "Update project notes and structure"
|
|
|
|
\# Push the updates to the server (tracking the main branch)
|
|
git push \-u origin main
|
|
|
|
### **2\. Pulling Updates from the Server**
|
|
|
|
If you worked on another device (like WSL) and pushed updates to Oracle, download those changes into your current workspace:
|
|
|
|
\# Fetch history changes without altering files
|
|
git fetch origin
|
|
|
|
\# Merge changes into your active branch
|
|
git pull origin main
|
|
|
|
## **Part 5: Alternative Environment Setup (WSL)**
|
|
|
|
If you switch over to WSL and want to clone or work on the same repository:
|
|
|
|
### **1\. Secure Your Private Key Permissions in Linux**
|
|
|
|
WSL enforces strict OpenSSH key security requirements:
|
|
|
|
chmod 700 \~/.ssh
|
|
chmod 600 \~/.ssh/ssh-key-2026-08-06.key
|
|
|
|
### **2\. Configure WSL SSH Config (\~/.ssh/config)**
|
|
|
|
Host oracle
|
|
HostName 129.213.172.214
|
|
User git
|
|
IdentityFile \~/.ssh/ssh-key-2026-08-06.key
|
|
|
|
### **3\. Clone the Remote Vault Down to WSL**
|
|
|
|
git clone oracle:da_new_shit.git
|