β¨ π GitHub for Network Engineersβββπ Basic Version Control for Router Configs and Automationβ¦
When I first started, configs lived in a dozen Excel files named things like rtr-core-final-v2.xlsx and scripts lived on one engineerβsβ¦
β¨ π GitHub for Network Engineers β π Basic Version Control for Router Configs and Automation Scripts

When I first started, configs lived in a dozen Excel files named things like
rtr-core-final-v2.xlsxand scripts lived on one engineerβs laptop. One midnight outage and a frantic βwho changed what?β later, we decided there had to be a better way. That better way was Git + GitHub: versioned history, code review, safe automation, and the kind of audit trail your operations team actually sleeps better for. This guide is for network engineers who want to step from CLI-and-Excel to GitHub-based version control for router configs and automation scripts β with minimal drama and maximum safety.
β¨ π Why GitHub matters for network teams π
GitHub isnβt just for app developers. For network operations, it provides:
- a single source of truth for configs and scripts;
- auditable history (who changed what, when, why);
- collaboration windows (pull requests, reviews, approvals);
- a platform for automation (CI/CD with Actions), testing, and safe rollouts.
3 Pros β
- Traceable history reduces incidents caused by unknown/undocumented edits.
- Pull-request workflows introduce peer review into network changes.
- Integrations (CI, ticketing, vaults) let you automate validation and deployment.
3 Cons β
- Cultural change β engineers must learn Git basics and PR etiquette.
- If misused, Git can store secrets (passwords) dangerously in history.
- Initial setup (backends, CI, permissions) requires ops work.
β¨ π§ Git basics for network engineers (practical primer) π
You donβt have to become a Git guru overnight. Start with these essentials:
# clone repo (one-time)
git clone git@github.com:yourorg/network-configs.git
# create branch for change
git checkout -b feat/add-loopback-R1
# edit device config or script
git add devices/r1/config.cfg
git commit -m "chore(config): add Loopback100 for monitoring on r1"
# push branch and open PR
git push origin feat/add-loopback-R1
Quick rules:
- One change per branch.
- Small commits, descriptive messages.
- Use PRs even for small changes to get peer review.
3 Pros β
- Small, atomic commits make rollbacks and diffs easy.
- Branch+PR model protects
main/prod. - Commit messages become the operational log.
3 Cons β
- Bad commit messages or huge diffs erode value.
- Binary blobs (Excel) are hard to diff in Git.
- Novice mistakes cause merge conflicts and confusion.
β¨ π Repo layout & file formats β recommended structure π
Organize for humans and tools. Example layout:
network-configs/
ββ README.md
ββ CONTRIBUTING.md
ββ inventories/
β ββ devices.yml
β ββ sites.csv
ββ configs/
β ββ ios/
β β ββ r1.cfg
β ββ junos/
β ββ rx1.conf
ββ templates/
β ββ interface.j2
ββ scripts/
β ββ backup_configs.py
β ββ deploy_config.py
ββ ci/
β ββ workflows/
ββ docs/
ββ rollback.md
Best practices
- Store configs in plain text (vendor CLI text) β not Excel.
- Use YAML/CSV for structured inventories that tools can parse.
- Keep templates (Jinja2) for rendering device-specific configs.
- Put automation scripts in
scripts/, with arequirements.txtand README.
3 Pros β
- Clear separation of data (inventories), templates, and generated configs.
- Humans and automation can both consume files.
- Easy to render device-specific configs programmatically.
3 Cons β
- Migration work required to convert existing Excel/Word docs to text.
- Teams must be disciplined about where files go.
- Without validators, human edits can introduce format drift.
β¨ π Branching & change workflow β safe patterns for configs π
Adopt a minimally opinionated workflow that fits change windows and emergency fixes:
- main β production-ready, protected.
- develop / staging β pre-production validation.
- feature/ or change/ branches** β one change per branch.
- *hotfix/ branches** β emergency patches with expedited PR rules.
PR flow:
- Create branch from
main. - Add config change or template update.
- Run pre-commit hooks & automated checks locally.
- Push and open PR; add reviewers (CODEOWNERS).
- CI runs validation (lint, config-diff, unit tests).
- After approvals & green CI, merge and trigger deployment pipeline.
3 Pros β
- Review & CI reduce risk of manual blunders.
- CODEOWNERS ensure the right people see changes.
- Hotfix workflows enable rapid, controlled rollback if needed.
3 Cons β
- Extra friction for trivial changes β cultural buy-in required.
- Misconfigured protections can delay urgent fixes.
- Conflicting changes require coordination (branch synchronization).
β¨ π Commit messages & PR descriptions β rules of the road π
Use simple, informative commit message conventions:
<type>(<scope>): <short summary>
<body β optional longer text>
Examples:
fix(r1): remove deprecated service-policy from Gi0/1feat(template): add interface description macro
PR template suggestions (create .github/pull_request_template.md):
- What change is this?
- Why? (ticket/incident link)
- How was it tested? (lab, simulation, dry-run)
- Rollback plan?
3 Pros β
- Future you (and audits) will thank you for clear context.
- PR templates encourage necessary operational checks.
- Tying to tickets creates traceability.
3 Cons β
- If messages are ignored, the system degrades.
- Overly verbose templates can be skipped or superficially filled.
- Linking to closed/removed tickets can break context β maintain tickets.
β¨ π Secrets & sensitive info β never store creds in Git πͺ
This is critical: do not commit passwords, SNMP community strings, or private keys. Options:
- Use .gitignore to avoid committing local secret files.
- Use GitHub Secrets for Actions (CI), or an external secrets manager (Vault, AWS Secrets Manager).
- Use encrypted files if absolutely necessary:
sops,git-cryptβ and manage keys carefully. - If a secret is accidentally committed: rotate it immediately, remove it from history (
git filter-repoor BFG), and investigate.
3 Pros β
- Secrets management prevents glaring security incidents.
- Secret stores provide audit, rotation, and limited access.
- CI integrations can inject secrets securely at runtime.
3 Cons β
- Mistakes happen β incident playbooks must exist.
- Encrypted workflows add operational complexity.
- Developers must learn secret management patterns.
β¨ βοΈ Automation & CI/CD β from PR to safe deployment π€
Use GitHub Actions (or GitLab CI) to automate validation and deployment:
Common CI jobs:
- lint-config β run vendor linters /
ciscoconfparsestyle checks. - render-test β render Jinja template with inventory and run
compare_config(NAPALM/Ansible) against a sandbox. - syntax-check β ensure generated config parses (some vendors support CLI parse-mode).
- deploy β after approvals and schedules, push config via secure pipeline (Ansible/Napalm/Nornir) to devices.
Simple Action skeleton:
name: Validate Config
on: [pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install deps
run: pip install -r scripts/requirements.txt
- name: Lint configs
run: python scripts/lint_configs.py
Safety features
- Use review & approval gates before deploy job runs.
- Require scheduled deploy windows (use Action approvals or a pipeline trigger).
- Test deployment jobs only with service accounts with least privilege.
3 Pros β
- CI automates repetitive checks and enforces consistency.
- Deploy pipelines reduce human typing errors.
- Integrations allow canary / staged rollouts.
3 Cons β
- Misconfigured CI can deploy bad configs at scale.
- CI needs secure secret injection for device credentials.
- Building reliable test/sandbox environments takes time.
β¨ π§ͺ Testing & validation β dry runs and sandboxes π§°
Never deploy untested changes to production. Strategies:
- Local dry-run: render templates and
diffagainst a stored running-config snapshot for the device. - Lab / simulator: use EVE-NG, CML, or vendor virtual devices to apply changes.
- Read-only validation: use NAPALM/Netmiko to pull
get_config()and compare with candidate. - Automated test suites: unit tests for render logic, integration tests for deployment paths.
Example test script outline:
- Render
r1.cfgfromtemplates/interface.j2andinventories/devices.yml. - Compare
renderedvsbaselinewithgit diff --no-index. - Fail CI if diffs include forbidden lines (like
no shutdownremoved on uplink).
3 Pros β
- Fewer outages because config errors are caught early.
- Tests document expected outcomes.
- Sandboxes let you rehearse complex changes.
3 Cons β
- Test maintenance cost grows with infra size.
- Emulated behavior can diverge from hardware.
- Tests that are too strict can block valid ops.
β¨ π Auditing, rollback & incident playbooks π
Git history + tags + releases provide the audit trail. For rollback:
- Tag known-good commits (
v1.2.3-prod). - Keep previous config snapshots (store in
/backup/directory or object store). - Have a documented rollback script: fetch the tagged config and re-apply via automation (with safety checks).
Incident playbook steps:
- Identify the offending commit (use git blame / PR logs).
- Revoke any automated change if in-flight; notify on-call.
- Revert commit or re-apply last-known-good.
- Do postmortem and add PR tests to prevent recurrence.
3 Pros β
- Fast, auditable rollbacks reduce outage time.
- PR descriptions + ticket links make postmortems actionable.
- Tags and releases mark safe snapshots for compliance.
3 Cons β
- Rolling back network state is not always instantaneous β side effects may linger.
- Some changes (BGP/route) have different rollback behavior.
- Reliance on a single automation path can be a single point of failure.
β¨ Collaboration & culture β getting the team on board π±
Adoption matters more than tooling. Steps:
- Create
CONTRIBUTING.mdwith step-by-step change process. - Run hands-on workshops to teach basic Git+PR flows.
- Define
CODEOWNERSso the right network owners review. - Hold βdoc cleanupβ events to move configs from Excel β text repo.
- Celebrate early wins and fast rollbacks publicly.
3 Pros β
- Shared ownership prevents tribal-knowledge outages.
- Lower bus factor β more people can make safe changes.
- Better on-call experience and reduced stress during incidents.
3 Cons β
- Training takes time away from operational tasks.
- Some engineers may chafe at new processes.
- Cultural shifts need repeated reinforcement.
β¨ π Summary Table β quick reference β
| β¨ Area | π Key Action | β
Benefit | β Risk |
| ----------- | ---------------------------------: | ------------------------ | --------------------------- |
| Repo layout | Text configs + templates + scripts | Machine + human friendly | Migration effort |
| Branching | One change per branch / PR | Review & audit trail | Friction for small fixes |
| Commits/PRs | Clear messages & templates | Traceability | Poor messages degrade value |
| Secrets | Use vaults / GH Secrets | Safer ops | Complexity & misconfig risk |
| CI/CD | Lint/render/test/deploy jobs | Automated validation | Misconfigured deploys |
| Testing | Sandboxes & diffs | Catch errors early | Maintenance cost |
| Rollback | Tags + backups + script | Faster recovery | Rollback side-effects |
| Culture | Docs + workshops + CODEOWNERS | Adoption & safety | Training time |
β¨ π Final Thoughts β how to get started (30/60/90 plan) π
30 days
- Create a repo skeleton (use the layout above).
- Move 1 small device config into plain-text & protect
main. - Run a short workshop to teach
git clone/ branch / PR basics.
60 days
- Add CI checks for lint/render tests.
- Convert automation scripts into
scripts/withrequirements.txt. - Implement
CODEOWNERSand PR approval rules.
90 days
- Add a deploy pipeline with a sandbox step and human approvals for production.
- Integrate secrets via a vault or GitHub Secrets.
- Practice rollback scenarios and add them to the runbook.
Closing advice (human tone) Start small. Move a single configuration or script and make that the poster child for the new process. Use PRs as your safety net and CI as your guard rail. Over time youβll get confidence, and the team will have fewer 3 a.m. surprises.
λ©νλ°μ΄ν°
- post_id
- 04dd35d9e354
- slug
- github-for-network-engineers-basic-version-control-for-router-configs-and-automation-04dd35d9e354
- url
- https://medium.com/@riki.satya.graha/github-for-network-engineers-basic-version-control-for-router-configs-and-automation-04dd35d9e354
- canonical_url
- https://medium.com/@riki.satya.graha/github-for-network-engineers-basic-version-control-for-router-configs-and-automation-04dd35d9e354
- author_url
- https://medium.com/@riki.satya.graha
- status
- ok
- fetched_at
- 2026-07-18 07:05:27