1. Install Required Tools
First, install git
and pandoc
on your Debian server:
bashCopyEditsudo apt update && sudo apt install -y git pandoc
2. Clone the Repository
Choose the GitHub repository you want to work with. Clone it using:
bashCopyEditgit clone https://github.com/username/repository.git
Replace:
username
with the GitHub account name.repository
with the repository name.
Navigate into the repo folder:
bashCopyEditcd repository
3. Convert README.md to DOCX
If the repository contains a README.md
file, convert it to DOCX:
bashCopyEditpandoc README.md -o README.docx
To convert all Markdown files in the repo:
bashCopyEditfor file in $(find . -name "*.md"); do
pandoc "$file" -o "${file%.md}.docx"
done
4. Set Up GitHub SSH Authentication (Passwordless Push)
4.1 Generate an SSH Key
Run:
bashCopyEditssh-keygen -t ed25519 -C "your_email@example.com"
- Press Enter when asked for a file location (or specify a custom name).
- Press Enter again to skip the passphrase (optional).
This will create two files in ~/.ssh/
:
id_ed25519
(private key)id_ed25519.pub
(public key)
4.2 Add SSH Key to GitHub
- Show your public key: bashCopyEdit
cat ~/.ssh/id_ed25519.pub
- Copy the output.
- Go to GitHub → Settings → SSH and GPG Keys → New SSH Key.
- Paste the key and save.
4.3 Configure SSH to Use the Key
Create a configuration file:
bashCopyEditnano ~/.ssh/config
Add:
bashCopyEditHost github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
Save and exit (Ctrl+O
, Enter, Ctrl+X
).
4.4 Test the SSH Connection
bashCopyEditssh -T git@github.com
You should see:
vbnetCopyEditHi username! You've successfully authenticated, but GitHub does not provide shell access.
5. Push Converted DOCX Files to Your Personal Repo
5.1 Change Remote URL to Your Repo
If you want to push to your personal GitHub repo:
bashCopyEditgit remote set-url origin git@github.com:your_username/your_repo.git
Check:
bashCopyEditgit remote -v
5.2 Add and Push Changes
bashCopyEditgit add README.docx
git commit -m "Add converted README.docx"
git push origin main
(Use main
or master
depending on your default branch.)
6. Downloading the DOCX File
If you just want to download the converted DOCX file to your local computer:
- Use
scp
: bashCopyEditscp user@your-vps-ip:/path/to/repo/README.docx ./README.docx
- Or set up a temporary web server: bashCopyEdit
python3 -m http.server 8080
Then openhttp://<your-vps-ip>:8080/README.docx
in your browser.
Optional: Automate Everything
Create a script convert_push.sh
:
bashCopyEdit#!/bin/bash
REPO_URL=$1
REPO_NAME=$(basename "$REPO_URL" .git)
# Clone repo if not exists
if [ ! -d "$REPO_NAME" ]; then
git clone "$REPO_URL"
fi
cd "$REPO_NAME" || exit
# Convert all .md files
for file in $(find . -name "*.md"); do
pandoc "$file" -o "${file%.md}.docx"
done
git add *.docx
git commit -m "Converted markdown files to DOCX"
git push origin main
Make it executable:
bashCopyEditchmod +x convert_push.sh
Run:
bashCopyEdit./convert_push.sh git@github.com:your_username/your_repo.git