GitPDM
An Open Source Github Based PDM Addon For FreeCAD
Install / Use
/learn @nerd-sniped/GitPDMREADME
GitPDM - Git-based Product Data Management for FreeCAD
Version Control Made Simple for Your CAD Projects
GitPDM is a FreeCAD workbench addon that brings Git version control and GitHub collaboration directly into FreeCAD. Think of it as “version history” for CAD projects, designed around FreeCAD documents, previews, and publishing.
Current Version: 0.3.0
Documentation Structure
- Tutorials — learning-oriented lessons for newcomers
- How-To Guides — goal-oriented recipes for specific tasks
- Technical Reference — accurate, “lookup-style” system details
- Explanations — background concepts and context to build understanding
Tutorials
Tutorial 1: First Local Versioned CAD Project
Goal: Install GitPDM, create a repository, and make two commits.
Prerequisites:
- FreeCAD (0.20, 0.21, or 1.0)
- Git installed and available on PATH (
git --versionworks)
1) Install GitPDM (manual)
-
Find your FreeCAD Mod folder:
- Windows: Press
Windows + R, enter%APPDATA%\FreeCAD\Mod - macOS: Finder →
Cmd + Shift + G→~/Library/Application Support/FreeCAD/Mod - Linux:
~/.FreeCAD/Mod/ - Create the folder if it doesn't exist.
- Windows: Press
-
Download the latest GitPDM release:
- https://github.com/nerd-sniped/GitPDM/releases
-
Copy the extracted
GitPDMfolder into the Mod folder so you have:Mod/GitPDM/Init.pyMod/GitPDM/InitGui.pyMod/GitPDM/freecad_gitpdm/
-
Restart FreeCAD.
-
In the workbench dropdown, select Git PDM.
2) Create a repository
- In the Git PDM toolbar, click Toggle GitPDM Panel.
- In the panel, click Browse for Folder.
- Create/select an empty folder for your project (example:
Documents/FreeCAD Projects/MyFirstProject). - Click Create Repo.
3) Create and save a simple part
- Switch to Part Design workbench.
- Create a new document: File → New.
- Create a simple box:
- Create Body → Create Sketch (XY)
- Draw a rectangle → Close
- Pad → length 10mm
- Save inside the repository folder as
simple-box.FCStd.
4) Commit v1
- Switch back to Git PDM workbench.
- In the panel, confirm
simple-box.FCStdshows up under Changes. - Enter commit message:
Add simple box part for testing - Click Commit.
5) Make a change and commit v2
- Switch to Part Design.
- Edit the Pad length from 10mm to 20mm.
- Save.
- Switch to Git PDM.
- Enter commit message:
Increase box height to 20mm - Click Commit.
You now have a local commit history you can always return to.
Tutorial 2: Connect to GitHub and Push for Backup
Goal: Authenticate to GitHub and push your local commits.
Prerequisites:
- Completed Tutorial 1
- A GitHub account
1) Connect GitHub (device flow)
- In the GitPDM panel, click Connect GitHub.
- A dialog appears with a short code.
- Click the dialog button to open GitHub (or visit https://github.com/login/device).
- Log in, enter the code, and click Authorize.
- Return to FreeCAD and confirm it shows “Connected”.
2) Push
- In the GitPDM panel, click Push.
- If prompted to set up the remote repository, follow the instructions shown.
- After success, verify your repo on GitHub at:
https://github.com/YOUR_USERNAME/YOUR_REPO_NAME
How-To Guides
Goal-oriented recipes for specific problems.
How to Install Git (Prerequisite)
Goal: Install Git and verify it works.
- Windows: install from https://git-scm.com/download/win, then restart; verify with
git --version. - macOS: run
git --versionin Terminal and install Xcode CLI tools if prompted. - Linux: install via your package manager (e.g.
sudo apt install git), verify withgit --version.
How to Fix Push Rejected
Goal: Push successfully when the remote moved ahead.
- Click Fetch.
- Click Pull.
- If Pull succeeds, try Push again.
- If you hit conflicts, you'll need to resolve them manually (until a dedicated UI exists).
How to Customize Preview Exports
Goal: Configure thumbnail/mesh settings.
- Create
.freecad-pdm/preset.jsonin your repository. - Add a preset (example):
{ "presetVersion": 1, "thumbnail": { "size": [1024, 1024], "projection": "perspective", "view": "isometric", "background": "#2C3E50", "showEdges": true }, "mesh": { "linearDeflection": 0.05, "angularDeflectionDeg": 20.0, "relative": false }, "stats": { "precision": 3 } } - Commit the preset.
- Run Publish Branch and confirm the outputs changed.
How to Fix “Git Is Not Recognized as a Command”
Goal: Make Git available to GitPDM.
- Install Git from https://git-scm.com/.
- Restart your computer (Windows commonly needs this).
- Verify in a terminal:
git --version
How to Fix GitHub Authentication Failures
Goal: Successfully connect GitPDM to GitHub.
- Confirm GitHub is reachable in a browser: https://github.com/
- Confirm your system clock is correct (OAuth is time-sensitive).
- Retry Connect GitHub and complete the device flow.
- If you see “Session expired” / “Token invalid”, disconnect and connect again.
- Check FreeCAD Report View for detailed
[GitPDM]errors.
How to Set Up Linux Token Storage (GNOME Keyring / KWallet)
Goal: Enable secure token storage on Linux.
- Install packages:
# Ubuntu/Debian sudo apt install python3-secretstorage gnome-keyring - Ensure a Secret Service compatible keyring daemon is running.
- Retry Connect GitHub in GitPDM.
Alternative: If a keyring is not available (headless systems), use SSH for Git operations.
How to Fix macOS Keychain Access Issues
Goal: Allow token storage in Keychain.
- Retry Connect GitHub and approve the Keychain prompt.
- If the prompt is blocked by system policy, consider granting FreeCAD/Python appropriate permissions in System Settings → Privacy & Security.
How to Fix Preview Export Failures
Goal: Get PNG/GLB/JSON (and optional STL) exports working.
- Confirm the document is saved inside the repository.
- Confirm the document has visible 3D geometry.
- Confirm FreeCAD is running in GUI mode.
- If using
.freecad-pdm/preset.json, confirm it is valid JSON. - Check Report View for the specific error.
Technical Reference
Accurate lookup documentation. Minimal narrative.
What GitPDM Does (Current Feature Summary)
- Version control of files inside a Git repository (commit/push/pull/fetch)
- Optional GitHub integration via OAuth device flow
- Preview export and publishing pipeline (thumbnail PNG, JSON metadata, STL)
- Safety guards to reduce risk of file corruption during risky operations
Known limitation: branch switching
Branch switching is currently limited because FreeCAD .FCStd files are ZIP archives and can be corrupted if the working directory changes while documents are open. GitPDM protects you by requiring documents to be closed for certain operations.
Requirements Summary
| Requirement | Version | Notes | |-------------|---------|-------| | FreeCAD | 0.20, 0.21, or 1.0 | Install from https://www.freecad.org/downloads.php | | Git | 2.20+ | Install from https://git-scm.com/ | | Python | 3.8+ | Bundled with FreeCAD | | PySide2 or PySide6 | Any | Bundled with FreeCAD | | GitHub account | N/A | Optional, for cloud features |
Platform Token Storage
GitHub tokens are stored using the host platform’s secure credential store.
- Windows: Windows Credential Manager
- macOS: Keychain
- Linux: Secret Service API (GNOME Keyring / KWallet)
Linux packages for Secret Service
# Ubuntu/Debian
sudo apt install python3-secretstorage gnome-keyring
# Fedora/RHEL
sudo dnf install python3-secretstorage gnome-keyring
# Arch Linux
sudo pacman -S python-secretstorage gnome-keyring
Preview Export Files
Preset file
- Path:
.freecad-pdm/preset.json - Format: JSON
Output layout (example)
previews/
parts/
mechanical/
base/
preview.png
preview.json
preview.glb
Logging
GitPDM logs to FreeCAD’s Report View.
- Enable: View → Panels → Report view
- Look for messages prefixed with
[GitPDM]
Settings Persistence
Settings are stored in FreeCAD’s parameter store:
User parameter:BaseApp/Preferences/Mod/GitPDM
Access via: Tools → Edit parameters...
Developer-Facing Architecture Overview
High-level modules:
auth/— GitHub OAuth device flow and token storagegit/— Git subprocess wrappergithub/— GitHub API clientexport/— preview generation pipelinecore/— shared utilities (logging, jobs, paths, settings)ui/— panel and handlers
Roadmap & Future Development (Project Information)
Known limitations
- Branch switching requires care (close documents first)
- Merge conflict resolution is currently manual
- Very large repositories can be slow to scan
Near-term focus
- GitApp integration to reduce reach of app (I realize it's currently a-lot)
- Enhanced branch/worktree UX
- Conflict resolution UI
- Git history viewer inside FreeCAD
- Improved diagnostics and more actionable error messages
Long-term ideas
- Pull request integration
- Support for additional hosting providers (GitLab/Bitbucket/self-hosted)
- Advanced Git operations for power users (rebase/cherry-pick/stash)
Explanations
Discursive background material to build understanding.
What Problem GitPDM Solves (for CAD work)
CAD projects evolve through many small edits: dimension tweaks, feature additions, assembly adjustments, refactors. Without s
