Git is the foundation of my code work: versioning, preserving history, and above all separating what is public from what is internal. This page covers the GitHub / GitLab nuance, the value of a self-hosted GitLab, and the repository discipline I apply daily.

GitHub & GitLab — the nuance

Criterion GitHub GitLab
Hosting modelSaaS (cloud)SaaS or self-hosted (on-premise)
Free editionCloud offeringCommunity Edition — open source, self-installable
Use in this projectPublic · training · portfolioInternal · professional code
Continuous integrationGitHub ActionsBuilt-in CI/CD pipelines
Distinctive strengthCommunity, visibilitySovereignty, full control over data
Why host your own GitLab? Hosting your own GitLab (Community Edition, open source) keeps code and its history outside the cloud: control over access, retention and backups, direct integration with on-premise infrastructure, and consistency with a sovereignty and compliance approach (ISO 27001). GitHub remains ideal for what is meant to be public (portfolio, training); an internal GitLab for what must stay controlled.

Two remotes, two uses

GitHub — public
  • Portfolio (web deployment)
  • Training projects
  • Knowledge base (private repository)
Internal GitLab — controlled
  • Professional code
  • History kept internal
  • Restricted and traced access
Isolation by architecture: professional code never passes through a public repository. This is not just an organizational rule, it is a structural separation of remotes.

Repository discipline & hygiene

Repository status (audit)
ProjectRemoteStatus
portfolioGitHub✓ Clean
Identified stray files
File / folderProblemFix
.idea/PyCharm configgit rm -r --cached .idea/
.venv/Python virtual envgit rm -r --cached .venv/
dist/PyInstaller buildgit rm -r --cached dist/
*.lnkWindows shortcutsExclude via .gitignore
🎯 Key takeaways
  • Always create the .gitignore before the first git add .
  • The remote repository keeps a copy of the history pushed to it; project backup and restore must be documented separately
  • Store tokens (PAT) in the system's credential manager, never in URLs
  • Only one active remote per project; rename master → main
  • --allow-unrelated-histories to merge two histories with no common ancestor
💻 First clean commit (workflow)
bash — hygiene + first push
# 1. .gitignore avant tout
#    .venv/  __pycache__/  .idea/  dist/  build/  *.spec  .env  *.lnk

# 2. Nettoyer le staging si des parasites ont été indexés
git rm -r --cached .idea/ .venv/ dist/

# 3. Branche principale + premier commit
git branch -m master main
git add .
git commit -m "feat: initial commit"

# 4. Remote (token dans le gestionnaire d'identifiants)
git config --global credential.helper manager
git remote add origin https://<gitlab-interne>/<utilisateur>/PROJET.git
git push -u origin main

# 5. Si le remote a déjà un commit initial (README auto)
git pull origin main --allow-unrelated-histories
git push -u origin main

Related pages

References & Sources

CategoryResourceURL
Official documentationGit — Documentationgit-scm.com/doc
Official documentationGitLab — Documentationdocs.gitlab.com
Official documentationGitHub Docsdocs.github.com
LicenseGit — GPLv2 · GitLab Community Edition — MITgnu.org/licenses/gpl-2.0
Content of this pageShared under CC BY-SA 4.0creativecommons.org/licenses/by-sa/4.0