How to enable 2FA/MFA on a GitHub account?

Learn how to enable 2FA/MFA on your GitHub account with this easy step-by-step guide and boost your account security in minutes.

Contact Us

Reviewed by Content Team

Daniel Goren, Head of Content

Updated June, 28

Guide

How to enable 2FA/MFA on a GitHub account?

 

How to Enable 2FA/MFA on a GitHub Account: A Step-by-Step Guide

 

Enabling Two-Factor Authentication (2FA) or Multi-Factor Authentication (MFA) on your GitHub account is one of the most effective ways to protect your code, projects, and personal information from unauthorized access. 2FA/MFA adds an extra layer of security by requiring not just your password, but also a second verification step—usually a code from your phone or an app. This guide will walk you through the process in simple terms, so even if you’re new to cybersecurity, you’ll feel confident and secure.

  • Log in to your GitHub account. Go to github.com and enter your username and password as usual.
  • Access your account settings. Click your profile picture in the top-right corner, then select “Settings” from the dropdown menu.
  • Navigate to the Security section. On the left sidebar, click “Password and authentication.” This is where you manage your login and security options.
  • Find the Two-Factor Authentication option. Look for the section labeled “Two-factor authentication” and click “Enable two-factor authentication.”
  • Choose your 2FA method. GitHub offers two main ways to receive your second authentication code:
    • Authentication app (recommended): Apps like Google Authenticator, Authy, or Microsoft Authenticator generate time-based codes. Download one of these apps on your smartphone if you don’t have one already.
    • SMS (text message): You can receive codes via text, but this is less secure than using an app.
  • Set up your authentication app. If you choose the app method, GitHub will show you a QR code. Open your authentication app, select “Add account” or the plus (+) sign, and scan the QR code. The app will start generating codes for your GitHub account.
  • Enter the code from your app. Type the 6-digit code from your authentication app into GitHub to confirm setup. If you chose SMS, enter the code sent to your phone.
  • Save your recovery codes. GitHub will give you a set of recovery codes. These are extremely important! If you lose access to your phone or app, these codes are the only way to get back into your account. Download or print them and store them in a safe place (not on your computer or phone).
  • Finish and test your setup. After confirming, GitHub will let you know that 2FA/MFA is enabled. The next time you log in, you’ll need both your password and a code from your app or SMS.

Why is 2FA/MFA important? Without 2FA/MFA, anyone who gets your password can access your GitHub account. With it, even if your password is stolen, attackers can’t get in without your second factor. This is a critical step for anyone who values their code, privacy, or works with sensitive projects.

If you need expert help with cybersecurity, readiness assessments, or want to make sure your organization is fully protected, consider reaching out to OCD Tech for professional consulting and guidance.

Enabling 2FA/MFA on GitHub is a simple but powerful way to secure your digital life. Take a few minutes to set it up and enjoy peace of mind knowing your account is much safer.

Need Help Securing Your Accounts?

Our cybersecurity experts can help you implement MFA and other critical protections. Book a free consultation to secure your business today.

Best Practices

Best Practices and Tips for Securing Your GitHub Account

 

Comprehensive Guide to Securing Your GitHub Account

 

GitHub security is crucial for protecting your code, personal information, and maintaining the integrity of your projects. With cybersecurity threats constantly evolving, implementing robust security measures for your GitHub account is essential. Let's explore key strategies to enhance your GitHub account security:

  • Create a Strong, Unique Password - Your password should be at least 12 characters long, combining uppercase and lowercase letters, numbers, and special characters. Avoid using the same password across multiple platforms. Consider using a reputable password manager to generate and store complex passwords.
  • Regularly Review Account Activity - Check your GitHub account's security log frequently (found under Settings > Security) to spot unauthorized access attempts. Unfamiliar locations or devices accessing your account could indicate a security breach.
  • Set Up SSH Keys - SSH (Secure Shell) keys provide a more secure way to connect to GitHub than passwords. They use cryptographic verification, making it extremely difficult for attackers to gain unauthorized access. Generate a unique SSH key pair for each device you use.
  • Use Personal Access Tokens Wisely - When accessing GitHub via API or command line, use personal access tokens with limited scopes and expiration dates. Never hardcode these tokens in your repositories or share them publicly.
  • Enable Login Notifications - Configure GitHub to send email alerts whenever someone logs into your account. This provides immediate notification of potential unauthorized access.
  • Secure Your Email Account - Your GitHub account is linked to your email. If your email is compromised, attackers can reset your GitHub password. Apply strong security measures to your email account as well.
  • Conduct Regular Repository Audits - Review collaborators, webhook settings, and deploy keys periodically. Remove access for individuals who no longer need it and delete unused webhooks or keys.
  • Implement Branch Protection Rules - For important repositories, set up branch protection rules to prevent direct pushes to critical branches like main or master. Require pull request reviews before merging changes.
  • Use Signed Commits - Verify the authenticity of code contributions by setting up GPG keys to sign your commits. This prevents others from impersonating you in commit history.
  • Enable Dependency Alerts - GitHub can notify you about vulnerabilities in your project dependencies. Enable Dependabot alerts to receive automatic notifications and pull requests to address security vulnerabilities.

Many organizations struggle with maintaining consistent security practices across their development teams. As noted by security specialists at OCD Tech, establishing organization-wide GitHub security policies and conducting regular security readiness assessments can significantly reduce the risk of breaches.

  • Limit Third-Party Access - Regularly review OAuth applications and GitHub Apps with access to your account. Revoke permissions for unused or suspicious applications.
  • Use Secret Scanning - Enable GitHub's secret scanning feature to detect accidentally committed credentials. If you accidentally push sensitive information, change those credentials immediately.
  • Keep Your Git Client Updated - Security vulnerabilities in Git clients can expose your repositories. Always use the latest version of Git and related tools.
  • Consider Private Repositories - For sensitive code or projects under development, use private repositories to limit exposure. Only share access with necessary collaborators.
  • Document Security Practices - Create a SECURITY.md file in your repositories outlining security policies and how to report vulnerabilities. According to OCD Tech consultants, clear security documentation improves team compliance with security best practices.
  • Implement IP Allowlists - For organizational accounts, configure IP allowlists to restrict access to your GitHub resources from specific IP addresses only.
  • Be Cautious with GitHub Actions - When using GitHub Actions for CI/CD, review and restrict workflow permissions. Use secrets for storing sensitive information rather than hardcoding them.

By implementing these security measures, you'll significantly reduce the risk of unauthorized access to your GitHub account and repositories. Remember that security is an ongoing process—regularly review and update your security practices as new threats emerge and as OCD Tech and other security experts recommend, conduct periodic security assessments to identify potential vulnerabilities before they can be exploited.

Explore Other 2FA/MFA guides

Browse our full suite of 2FA setup guides —or partner with OCD Tech to harden your security.

2FA/MFA

Brex

Learn how to enable 2FA/MFA on your Brex account with this step-by-step guide to boost security and protect your business from unauthorized access.

Learn More

2FA/MFA

Mendix

Learn how to enable 2FA/MFA on your Mendix account with this step-by-step guide to boost security and protect your data from unauthorized access.

Learn More

2FA/MFA

OutSystems

Learn how to enable 2FA/MFA on your OutSystems account with this step-by-step guide to boost security and protect your data from unauthorized access.

Learn More

2FA/MFA

Tallyfy

Learn how to enable 2FA/MFA on your Tallyfy account to boost security. Step-by-step guide for setting up two-factor authentication and protecting your data.

Learn More

2FA/MFA

Pipefy

Learn how to enable 2FA/MFA on your Pipefy account with this step-by-step guide and boost your account security with two-factor authentication.

Learn More

2FA/MFA

Appian

Learn how to enable 2FA/MFA on your Appian account with this easy step-by-step guide to boost security and protect your data from unauthorized access.

Learn More
View All

Customized Cybersecurity Solutions For Your Business

Contact Us

Frequently asked questions

What services does OCD Tech provide?

OCD Tech offers a comprehensive suite of cybersecurity and IT assurance services, including SOC 2/3 and SOC for Cybersecurity reporting, IT vulnerability and penetration testing, privileged access management, social engineering assessments, virtual CISO (vCISO) support, IT general controls audits, WISP development, and compliance assistance for frameworks like CMMC, DFARS, and FTC Safeguards.

Which industries does OCD Tech serve?

OCD Tech specializes in serving highly regulated sectors such as financial services, government, higher education, auto dealerships, enterprise organizations, and not-for-profits throughout New England.

How long does an IT security assessment take?

Typically, OCD Tech’s on-site work spans 1–2 days, depending on complexity and number of sites, followed by 1–2 weeks of analysis and reporting to deliver clear, actionable recommendations.

Why should I get SOC 2 compliant?

SOC 2 reporting demonstrates to clients and prospects that an organization follows best-in-class controls over security, availability, processing integrity, confidentiality, and privacy—boosting trust, meeting RFP/due diligence requirements, and helping secure contracts. OCD Tech helps organizations achieve and maintain this compliance.

Can OCD Tech help me with federal cybersecurity regulations?

Yes—OCD Tech provides guidance for compliance with DFARS (NIST 800‑171), CMMC (Levels 1–3), and FTC Safeguards, ensuring organizations meet specific government or industry-based cybersecurity mandates.

What is a virtual CISO (vCISO), and do I need one?

A virtual CISO delivers strategic, executive-level cybersecurity leadership as a service. OCD Tech’s vCISO service is ideal for organizations lacking a full-time CISO and helps build programs, define policy, oversee risk, and guide security maturity.

Does OCD Tech offer ongoing security training or audits for staff?

Absolutely. OCD Tech provides tailored internal IT Audit training and security awareness sessions, plus annual reviews of Written Information Security Programs (WISP), such as Massachusetts 201 CMR 17 and other state or industry-specific controls.

Audit. Security. Assurance.

IT Audit | Cybersecurity | IT Assurance | IT Security Consultants – OCD Tech is a technology consulting firm serving the IT security and consulting needs of businesses in Boston (MA), Braintree (MA) and across New England. We primarily serve Fortune 500 companies including auto dealers, financial institutions, higher education, government contractors, and not-for-profit organizations with SOC 2 reporting, CMMC readiness, IT Security Audits, Penetration Testing and Vulnerability Assessments. We also provide dark web monitoring, DFARS compliance, and IT general controls review.

Contact Info

OCD Tech

25 BHOP, Suite 407, Braintree MA, 02184

844-623-8324

https://ocd-tech.com

Follow Us

Videos

Check Out the Latest Videos From OCD Tech!

Services

SOC Reporting Services
SOC 2 ® Readiness Assessment
SOC 2 ®
SOC 3 ®
SOC for Cybersecurity ®
IT Advisory Services
IT Vulnerability Assessment
Penetration Testing
Privileged Access Management
Social Engineering
WISP
General IT Controls Review
IT Government Compliance Services
CMMC
DFARS Compliance
FTC Safeguards vCISO

Industries

Financial Services
Government
Enterprise
Auto Dealerships