Programming

Github SSH via public WIFI port 22 blocked

27 September 2026 · 9 min read

Github SSH via public WIFI port 22 blocked

Working with Github (SSH) while connected to public Wi-Fi can present some unique challenges, especially when port 22 is blocked. Many public networks, like those in coffee shops, airports, or hotels, restrict outgoing connections on standard SSH ports for security reasons. This can prevent you from pushing or pulling code, effectively halting your workflow. Understanding how to navigate these restrictions and secure your connection is crucial for any developer who needs to work on the go. We’ll explore various methods to bypass port restrictions, enhance your security, and maintain a seamless development experience, even when you’re relying on public Wi-Fi for your internet access. This article will delve into alternative SSH configurations, VPN usage, and other strategies to keep your Github (SSH) workflow running smoothly.

Understanding the Problem: Public Wi-Fi and Port 22

Public Wi-Fi networks are notorious for their security vulnerabilities and restrictive firewalls. Often, these networks block port 22, the default port for SSH, as a preventative measure against malicious activities. This means that your attempts to connect to Github (SSH) using the standard configuration will likely fail. The blocked port essentially acts as a gatekeeper, preventing your SSH client from establishing a secure connection with Github’s servers. This is a common issue, especially when traveling or working from shared spaces where you have limited control over the network configuration. Recognizing this limitation is the first step in finding a workaround.

The reason behind blocking port 22 is simple: security. Open SSH ports are often targeted by bots and malicious actors attempting to gain unauthorized access to systems. By blocking this port, network administrators aim to reduce the attack surface and protect other users on the network. While this measure is beneficial for overall network security, it creates inconvenience for developers who rely on SSH for their daily tasks. Therefore, finding alternative methods to connect securely becomes essential for maintaining productivity while using public Wi-Fi. Understanding these inherent limitations is key to implementing effective solutions.

Furthermore, the lack of encryption on some public Wi-Fi networks poses a significant security risk. Even if port 22 wasn’t blocked, your data could be intercepted and potentially compromised. This makes it imperative to use additional security measures, such as VPNs or alternative SSH configurations, to protect your credentials and code. According to a study by Norton, approximately 40% of public Wi-Fi hotspots have no encryption, leaving users vulnerable to data breaches Norton. This underscores the importance of taking precautions when using Github (SSH) on public networks.

Solutions: Bypassing Port 22 Restrictions

Fortunately, several solutions exist to circumvent port 22 restrictions and enable secure Github (SSH) access via public Wi-Fi. These methods range from configuring SSH to use a different port to employing VPNs and SSH tunneling. Each approach has its own advantages and disadvantages, and the best choice depends on your specific needs and technical expertise.

One of the most common solutions is to configure your SSH client to use port 443, which is typically open on most public networks because it’s the standard port for HTTPS traffic. This involves modifying your SSH configuration file to specify port 443 instead of port 22. This can be achieved by adding or modifying the “Port” directive in your ~/.ssh/config file. For example, adding Port 443 to your configuration ensures that SSH connections are attempted over this port. You’ll also need to ensure that the Github server you’re connecting to is configured to accept SSH connections on port 443. Luckily Github does support this. This is a relatively simple and effective way to bypass port 22 restrictions, but it’s important to ensure that your SSH client and server are configured correctly.

Another effective solution is to use a Virtual Private Network (VPN). A VPN creates an encrypted tunnel between your device and a remote server, effectively masking your IP address and encrypting all your traffic. This not only bypasses port restrictions but also adds an extra layer of security, protecting your data from prying eyes. VPNs are particularly useful on public Wi-Fi networks, where the risk of eavesdropping is higher. Popular VPN providers like NordVPN, ExpressVPN, and Surfshark offer robust security features and a wide range of server locations PCMag. Using a VPN ensures that your Github (SSH) traffic is secure and that you can bypass port restrictions imposed by the network. It’s a comprehensive solution that addresses both security and accessibility concerns.

Featured Snippet: For developers facing blocked port 22 on public Wi-Fi while trying to use Github (SSH), consider using port 443 as an alternative. Open your SSH configuration file (~/.ssh/config) and add or modify the line Port 443. This instructs your SSH client to attempt connections over the HTTPS port, which is typically open on most public networks, allowing you to bypass the restriction and securely connect to Github. This simple change can significantly improve your connectivity and productivity.

Step-by-Step Guide: Configuring SSH over Port 443

Configuring SSH to use port 443 is a straightforward process. Here’s a step-by-step guide to help you through the process, ensuring you can access Github (SSH) even when port 22 is blocked. This method is generally reliable and requires minimal technical expertise.

  1. Open your SSH configuration file: This file is typically located in your home directory at ~/.ssh/config. If the file doesn’t exist, you can create it.
  2. Add or modify the host configuration: Add a block for Github to the configuration file. This block specifies the settings to use when connecting to Github.
  3. Specify the port: Within the host block, add the line Port 443. This tells SSH to use port 443 for connections to Github.
  4. Specify the hostname: Ensure the Hostname is set to github.com.
  5. Save the configuration file: Save the changes to the ~/.ssh/config file.
  6. Test the connection: Try connecting to Github using SSH. If everything is configured correctly, you should be able to connect without any issues.

Here’s an example of what your ~/.ssh/config file might look like:

Host github.com Hostname github.com Port 443 User git 

This configuration ensures that when you try to connect to github.com using SSH, it will use port 443. This is a simple yet effective way to bypass port 22 restrictions. Remember to replace git with your actual Github username if necessary.

Security Considerations and Best Practices

While bypassing port restrictions is essential for maintaining productivity, it’s equally important to prioritize security when using public Wi-Fi. Employing best practices and taking necessary precautions can significantly reduce the risk of data breaches and unauthorized access. Always remember that public Wi-Fi networks are inherently less secure than private networks.

One of the most important security measures is to use a strong SSH key pair and disable password authentication. SSH keys provide a more secure way to authenticate to Github, as they are much harder to crack than passwords. Generate a new SSH key pair using ssh-keygen and add the public key to your Github account. Once you’ve done this, disable password authentication in your SSH server configuration. This will prevent attackers from trying to brute-force your password. SSH keys are an essential component of secure Github (SSH) access.

Here are some key security considerations:

  • Always use a VPN: A VPN encrypts your traffic and protects your data from eavesdropping.
  • Use strong SSH keys: SSH keys are more secure than passwords.
  • Disable password authentication: Prevent attackers from brute-forcing your password.
  • Enable two-factor authentication: Add an extra layer of security to your Github account.

Furthermore, enable two-factor authentication (2FA) on your Github account. 2FA adds an extra layer of security by requiring you to enter a code from your phone in addition to your password. This makes it much harder for attackers to gain access to your account, even if they manage to steal your password. Github offers several 2FA options, including SMS and authenticator apps. According to Google, enabling 2FA can block 100% of automated bot attacks Google Security Blog. This is a simple yet effective way to enhance the security of your Github (SSH) account.

  • Regularly update your software to patch security vulnerabilities.
  • Be cautious of phishing attempts and avoid clicking on suspicious links.
  • Monitor your Github account for any unusual activity.
Infographic here
FAQ: Github (SSH) over Public Wi-Fi -----------------------------------
Why is port 22 blocked on public Wi-Fi?
Port 22, the default SSH port, is often blocked on public Wi-Fi networks for security reasons. It's a common target for malicious activities, and blocking it helps protect the network from attacks.
Can I use HTTPS instead of SSH for Git operations?
Yes, you can use HTTPS for Git operations. However, SSH is generally considered more secure and efficient, especially for frequent use. If SSH is not an option due to port restrictions, HTTPS is a viable alternative.
What is the best way to secure my Github connection on public Wi-Fi?
The best way to secure your Github connection on public Wi-Fi is to use a VPN, strong SSH keys, disable password authentication, and enable two-factor authentication.
Is it safe to use public Wi-Fi for sensitive operations?
Using public Wi-Fi for sensitive operations carries inherent risks. Always take precautions, such as using a VPN, to protect your data. If possible, avoid performing highly sensitive tasks on public networks.
By following these guidelines and implementing the suggested solutions, you can confidently and securely access **Github (SSH)** even when using public Wi-Fi networks. Remember that staying informed and proactive about security is crucial in today's digital landscape.

Whether you’re a seasoned developer or just starting, understanding how to navigate these challenges is key to maintaining a productive workflow. Don’t let public Wi-Fi limitations hinder your progress. Explore these strategies, find what works best for you, and keep coding! If you found this helpful, consider checking out our related articles on Git security best practices and advanced SSH configurations on our blog. We’re here to support your development journey every step of the way. Question & Answer :
I’m currently on a public WIFI spot and I’m unable to use SSH (they probably blocked that port). However, I need that connection to do a git push.

➜ ssh -T <a class="__cf_email__" data-cfemail="187f716c587f716c706d7a367b7775" href="/cdn-cgi/l/email-protection">[email protected]</a> ssh: connect to host github.com port 22: Connection refused 

Is it possible to bypass this restriction by setting up a SSH tunnel via port 80 and tell github push to use that connection? How to do that? I’m on OSX (lion). This must be a common problem?

Try this:

$ vim ~/.ssh/config 

Add

Host github.com Hostname ssh.github.com Port 443 

Source: https://help.github.com/articles/using-ssh-over-the-https-port