Releasing internal company code as an open source project can improve your engineering reputation, attract contributors, and give back to the community. It also carries legal, security, and maintenance responsibilities. This guide walks you through the entire process, from gaining approval to publishing and maintaining your project.

What You'll Need

  • Approval from your manager or legal department (if you don't have authority to release code).
  • A code repository that you have the rights to publish (no third-party proprietary code).
  • A code hosting platform account (GitHub, GitLab, or Bitbucket) with permission to create public repositories.
  • Basic familiarity with Git and your project's build system.

Step-by-Step

  1. Get internal approval. Before doing anything, confirm with your manager or legal team that the code can be released. They will check for intellectual property issues, export restrictions, and any contractual obligations. If your company has an open source policy, follow it. If not, ask for written approval.
  2. Audit the codebase. Review the entire codebase for anything that should not be public: hardcoded credentials (API keys, passwords, tokens), internal infrastructure details (server names, IP addresses), personal data, or references to proprietary systems. Use automated tools like gitleaks or trufflehog to scan for secrets, but also do a manual review of configuration files and documentation.
  3. Remove sensitive information. Replace secrets with placeholder values or environment variables. If you find real credentials in Git history, you must rewrite history (e.g., with git filter-repo) or start a fresh repository. Also remove any internal comments that reveal business strategy or confidential information.
  4. Choose a license. Select an open source license that fits your goals. Popular choices: MIT (permissive, allows commercial use), Apache 2.0 (permissive with patent grant), GPLv3 (copyleft, requires derivatives to be open source). If you're unsure, consult your legal team. The license must be included in the repository, usually as a LICENSE file.
  5. Add a README and contributing guidelines. Write a clear README that explains what the project does, how to install and use it, and how to build it from source. Include a CONTRIBUTING.md file that describes how people can submit issues or pull requests. Add a CODE_OF_CONDUCT.md if you want to set community expectations.
  6. Set up project metadata. On your hosting platform, fill in the project description, topics, and website (if any). Add a CHANGELOG.md if you have a history of changes. Consider adding badges for build status, license, and version.
  7. Prepare the repository. Ensure the code builds and passes tests in a clean environment. Remove any dependencies that are not legally distributable. If the code relies on internal services, document how to mock or replace them.
  8. Create the public repository. On GitHub, for example, click the "New repository" button, choose a name, set it to "Public", and select the license you chose. Do not initialize with a README if you're pushing an existing repository—you'll avoid merge conflicts.
  9. Push the code. Add the remote and push your main branch:
  10. git remote add origin https://github.com/your-org/your-repo.git
  11. git push -u origin main
  12. If you're starting fresh, you can clone an empty repo and add files.
  13. Enable issue tracking and discussions. Turn on the Issues feature (usually on by default). Consider enabling Discussions if you want a forum for questions. Set up labels like "good first issue" to welcome new contributors.
  14. Announce the project. Share the repository link on your company blog, social media, or relevant developer communities (e.g., Hacker News, Reddit, or niche forums). Write a short post explaining what the project does and why you released it.
  15. Plan for maintenance. Decide who will respond to issues and review pull requests. Set expectations in the README about response times. If the project is not actively maintained, say so clearly (e.g., "archived" or "maintenance mode").

Common Mistakes

  • Forgetting to remove secrets from Git history. Even if you delete a file, the secret remains in previous commits. Use history rewriting tools before publishing.
  • Choosing the wrong license. A license that is too restrictive may discourage adoption; one that is too permissive might not protect your company's interests. Get legal advice.
  • Releasing code that depends on internal services. If the code won't run without your company's private APIs, it's not useful to outsiders. Provide stubs or documentation.
  • Not adding a README. A project without instructions is hard to use and may be ignored.
  • Ignoring contributor guidelines. Without clear guidelines, you may receive low-quality or duplicate contributions.

Tips

  • Start small: release a library or tool that is self-contained rather than a massive application.
  • Use a permissive license (MIT or Apache 2.0) to maximize adoption if that's your goal.
  • Add a SECURITY.md file to explain how to report vulnerabilities privately.
  • Tag releases with semantic versioning (e.g., v1.0.0) to help users track changes.
  • Set up continuous integration (CI) to automatically run tests on pull requests—this reduces your review burden.
  • Respond to issues promptly, even if it's just to say "we'll look at this next week."

Troubleshooting

If the release does not go as planned, here are common issues and fixes:

  • You discover a secret after publishing. Immediately revoke the credential (e.g., rotate the API key), then remove it from the repository and history. Consider force-pushing the cleaned history, but be aware that anyone who cloned the repo may still have the old history. Notify affected users if necessary.
  • The code does not build for external users. Check for missing dependencies, absolute paths, or environment-specific settings. Add a CONTRIBUTING.md section on build prerequisites. Ask a colleague to try building from a clean clone.
  • You receive a takedown request for copyright infringement. If someone claims you used their code without permission, remove the offending code immediately and consult legal. You may need to rewrite that portion.
  • Your company wants to revoke the open source release. This is difficult once published. You can archive the repository (making it read-only) but you cannot force people to delete forks. Discuss this risk before publishing.
  • No one contributes. This is normal; many open source projects have few external contributors. Focus on making the project useful and well-documented. You can still benefit from the exposure.

Frequently Asked Questions

Do I need to clean the Git history before publishing?

Yes, if the history contains secrets, proprietary code, or internal comments. Use git filter-repo to remove files or rewrite commits. If the history is large, you might start a fresh repository with a single initial commit.

What license should I choose for a company project?

It depends on your goals. MIT is simple and permissive; Apache 2.0 adds an explicit patent grant; GPLv3 requires derivative works to be open source. Consult your legal team to align with company policy.

Can I release code that uses third-party libraries?

Yes, but you must ensure the licenses of those libraries are compatible with your chosen license. For example, GPL code cannot be combined with proprietary code. Check the license of each dependency.

How do I handle contributions from employees?

Have employees sign a Contributor License Agreement (CLA) if required by your company. This clarifies that the company can relicense the code if needed. Many projects use a bot to check for CLA signatures.

What if the code is not perfect?

That's okay. Open source does not require perfection. Clearly state the project's maturity in the README. You can mark it as "alpha" or "beta" if it's early stage.

Should I release the code under a company name or a personal account?

Use a company account if you want to maintain ownership and control. If it's a side project, a personal account is fine, but check your employment contract for intellectual property clauses.