GitHub blocked access for users from Iran in 2019 at the request of OFAC ā the US regulator that oversees sanctions compliance. Since then, Iranian developers have faced the same situation: repositories are inaccessible, push and pull requests fail, and accounts can be frozen at any moment. However, work does not stop ā teams continue to commit, deploy, and participate in open-source projects. In this article, we analyze what really works in 2024ā2025, which proxies are suitable for GitHub, and how to set them up correctly without losing speed.
Why GitHub Blocks Iran: Sanctions and Technical Implementation
In July 2019, GitHub began restricting access for users from Iran, Crimea, Cuba, Syria, and North Korea. The reason is the requirements of OFAC (Office of Foreign Assets Control) under US sanctions legislation. Microsoft, which has owned GitHub since 2018, is obligated to comply with these restrictions as an American company.
Technically, the blocking works on several levels:
- Geoblocking by IP: GitHub determines the country by IP address and blocks requests from the Iranian address range (AS blocks belonging to Iranian providers).
- Account Freezing: Accounts registered from Iranian IPs or with Iran specified in the profile may be switched to read-only mode or completely frozen.
- Blocking Private Repositories: Public repositories are partially accessible for reading, but private ones are completely closed.
- Restrictions on GitHub Actions and Packages: CI/CD pipelines and package registries are also unavailable from blocked regions.
At the same time, GitHub has repeatedly stated that it opposes these restrictions and lobbies for relaxations with regulators. In 2019, the company obtained permission to provide free access to public repositories for Iranian developers, but the complete lifting of the block has not occurred.
ā ļø It is important to understand: The blocking is aimed at organizations and government structures under sanctions, not against individual developers. Most Iranian programmers work in international teams and are not personally subject to sanctions ā but technically the system blocks everyone by IP.
This is why the solution to the problem lies in changing the IP address ā this is the only way to technically bypass geoblocking. Let's explore which tools are suitable for this.
What Actually Works: Proxies, VPNs, and Workarounds
Iranian developers use several approaches. Each has its pros and cons ā let's analyze them honestly, without marketing.
1. Residential Proxies
Residential proxies use real IP addresses of home users from other countries ā Germany, the Netherlands, the USA, Turkey. From GitHub's perspective, such a request looks like a request from an ordinary user from an allowed country. This is the most reliable option for continuous work: minimal risk of blocking the proxy itself, high stability.
The downside is that the speed is lower than that of data center proxies, and the cost is higher. For Git operations (push/pull/clone), this is usually not critical: repositories are measured in megabytes, not gigabytes.
2. Data Center Proxies
Data center proxies work faster and are cheaper. They are suitable for cloning large repositories, downloading artifacts, and working with the GitHub API. However, data center IPs are easier to identify as proxies ā some ranges are already blacklisted by GitHub. We recommend using data center proxies from European locations (DE, NL, FR) ā they are less likely to get caught by filters.
3. VPN
VPNs are the most popular tool among Iranian users. They operate at the operating system level and do not require configuration in each application separately. Downsides: many VPN servers are already blocked by GitHub (especially popular free ones), speed is unstable, and if the connection drops, traffic may leak through the Iranian IP.
4. Tor
Tor technically works, but GitHub actively blocks Tor exit nodes. The speed is extremely low ā cloning even a small repository can take hours. It is suitable for occasional access to the web interface, but not for regular development.
5. SSH Tunnels through a Server in Another Country
If you have a VPS in Europe or the USA, you can set up a SOCKS5 proxy through an SSH tunnel. This is technically reliable and free (if you have a server), but requires basic Linux knowledge. More details on the setup can be found in the Git section.
Summary of Tools:
For daily work with GitHub, the optimal combination is: residential or data center proxy + configuration in Git at the config level. This provides stability without affecting the entire system traffic.
Which Types of Proxies are Suitable for GitHub: Comparative Table
Let's break down all options in one table to make it easy to choose for your situation:
| Type | Speed | Reliability | Risk of GitHub Block | Best for |
|---|---|---|---|---|
| Residential Proxies | Average | High | Minimal | Daily work, push/pull, web interface |
| Data Center Proxies | High | Average | Medium | Cloning large repos, GitHub API, CI/CD |
| Mobile Proxies | Average | Very High | Very Low | Working with an account if it is already under suspicion |
| VPN (Paid) | Average | Average | Medium | General internet access + GitHub |
| SSH Tunnel (Own VPS) | High | High | Low | Developers with VPS in Europe/USA |
| Tor | Very Low | Low | High | Not recommended for working with Git |
If your account has already received warnings or has been temporarily frozen, consider using mobile proxies ā they use IPs from mobile operators, which GitHub almost never blocks, as thousands of users share a single mobile IP.
How to Set Up Proxies in Git, Terminal, and IDE: Step-by-Step Guide
The main advantage of setting up a proxy specifically in Git (rather than at the system level or VPN) is that you control which traffic goes through the proxy. Local requests remain direct, only GitHub traffic is routed through the external IP.
Setting Up HTTPS Proxy in Git (Globally)
Open the terminal and execute the following commands, replacing HOST and PORT with your proxy details:
# For HTTP/HTTPS proxy: git config --global http.proxy http://HOST:PORT # For SOCKS5 proxy (recommended): git config --global http.proxy socks5://HOST:PORT # If the proxy requires authentication (username + password): git config --global http.proxy socks5://USERNAME:PASSWORD@HOST:PORT # Apply only for github.com (do not affect other repositories): git config --global http.https://github.com.proxy socks5://HOST:PORT
The last command is the most useful: it applies the proxy only for requests to github.com, without affecting GitLab, Bitbucket, or internal company repositories.
Checking the Configuration
# View current proxy settings in Git: git config --global --list | grep proxy # Test connection to GitHub through the proxy: git ls-remote https://github.com/github/gitignore HEAD
If the ls-remote command returned a commit hash ā the proxy is working. If you receive a Connection refused or Could not resolve host error ā check the correctness of HOST and PORT.
Disabling the Proxy (When Not Needed)
# Remove global proxy: git config --global --unset http.proxy # Remove proxy only for github.com: git config --global --unset http.https://github.com.proxy
Setting Up in VS Code
VS Code uses system proxy settings for the integrated terminal and extensions. If you set up the proxy in Git via the terminal, the integrated terminal in VS Code will automatically pick up these settings. For HTTP proxy in the editor itself (for example, for installing extensions), open:
File ā Preferences ā Settings ā search "proxy" ā specify the proxy address in the http.proxy field.
Setting Up via SSH Tunnel (If You Have Your Own VPS)
If you have a VPS in Europe or the USA, you can set up a local SOCKS5 proxy via SSH with one command:
# Create a SOCKS5 proxy on local port 1080 via SSH: ssh -D 1080 -C -N user@your-vps-ip # Then in Git specify this local proxy: git config --global http.proxy socks5://127.0.0.1:1080
The flag -D 1080 opens a SOCKS5 proxy on port 1080, -C enables compression, and -N tells SSH not to execute commands ā just to keep the tunnel open.
SSH vs HTTPS: Which Works Better Through Proxies for GitHub
This is one of the most common questions: which protocol to use for working with GitHub through a proxy ā SSH (port 22 or 443) or HTTPS (port 443)?
HTTPS through Proxy
HTTPS connections are easy to proxy ā the commands git config http.proxy that we discussed above work specifically for HTTPS. The downside: with each push/pull, Git requests a username and password (or Personal Access Token). The solution is to save the token in the credential store:
# Enable token storage in the system keychain: git config --global credential.helper store # After the first successful push, the token will be saved automatically
SSH through Proxy (ProxyCommand)
SSH connections cannot be proxied through the standard http.proxy in Git ā a separate setup is needed in ~/.ssh/config. Add the following block:
Host github.com
HostName ssh.github.com
User git
Port 443
ProxyCommand nc -X 5 -x HOST:PORT %h %p
Here ssh.github.com:443 is a special SSH endpoint for GitHub that operates on port 443 (HTTPS), which helps bypass blocks on port 22. nc -X 5 uses SOCKS5 proxy.
You can check the SSH connection with the command:
ssh -T [email protected] # Expected response: Hi username! You've successfully authenticated...
Recommendation:
For most developers, it's easier to set up HTTPS + SOCKS5 proxy in Git config. SSH through ProxyCommand requires installing the netcat utility and a slightly more complex configuration, but allows for convenient work with SSH keys without entering a token.
Account Risks and How to Minimize Them
Using proxies for GitHub is not only a technical task but also a matter of account security. Incorrect configuration can draw attention to the account or create new problems.
Risk 1: Constant IP Changes
If you use rotating proxies (IP changes with each request or every few minutes), GitHub may detect suspicious activity: one account logging in from dozens of different IPs in a short time. This is a trigger for security checks and potential blocking.
Solution: Use static (sticky) proxies with a fixed IP or session proxies with a long session duration (from 24 hours). For GitHub, rotation is not needed ā stability is required.
Risk 2: Using Blocked Data Center IPs
Some IP ranges from popular hosting providers (AWS, DigitalOcean, Vultr) are already blacklisted or attract increased attention. GitHub does not block them directly, but may request additional verification.
Solution: Choose European data centers (DE, NL, CH) ā they are less likely to get blacklisted. Before using them permanently, check the IP through ipinfo.io or scamalytics.com.
Risk 3: Iranian Data in Profile
If your GitHub profile specifies Iran (in the Location field), the account is more likely to fall under restrictions regardless of the IP. This does not mean you need to hide your origin ā but it is worth understanding that this is an additional factor.
Risk 4: Working with Organizational Repositories
If your organization on GitHub is registered as an Iranian company or has Iranian administrators, the restrictions may be stricter ā up to freezing the entire organization. In this case, a proxy helps for a personal account but does not solve the problem at the organizational level.
What to Do If the Account is Already Frozen
GitHub provides an official process for unfreezing accounts for individual developers. Write to [email protected] explaining the situation. In the email, include:
- That you are an individual developer not associated with sanctioned organizations
- That your activity is open-source or commercial software development
- Links to your public repositories and activity
According to community experience, GitHub restores access for most individual developers within 1ā4 weeks.
Checklist: Quick Proxy Configuration Check for GitHub
Use this checklist to ensure everything is set up correctly before starting work:
ā Before Configuration
- Obtain proxy details: HOST, PORT, type (HTTP/SOCKS5), username/password
- Check the proxy IP on
ipinfo.ioā the country should not be Iran - Ensure the IP is not on the blacklist: check on
scamalytics.com - Choose a static IP (not rotating) for permanent work
ā Git Configuration
- The command
git config --global http.proxyhas been executed - The proxy is applied only for github.com (not globally) ā if point configuration is needed
- credential.helper is configured to store the token (for HTTPS)
- For SSH: a block has been added to
~/.ssh/configwith ProxyCommand
ā Functionality Check
- The command
git ls-remote https://github.com/github/gitignore HEADreturns a hash - The command
ssh -T [email protected]returns a greeting (for SSH) - Push to a test repository was successful
- No errors
403 ForbiddenorRepository access blocked
ā Account Security
- A static IP is used (not rotating)
- Two-factor authentication is enabled on the GitHub account
- Personal Access Token is configured with the minimum necessary permissions (only repo)
- The token has an expiration date (not indefinite)
Conclusion
The sanctions imposed by GitHub are an unpleasant reality for Iranian developers, but not a dead end. A technical solution exists and works: proxies with foreign IPs combined with the correct Git configuration allow for full-fledged development ā pushing commits, cloning repositories, working with GitHub Actions, and participating in open-source projects.
Key takeaways from the article:
- For daily work, choose static residential or data center proxies from Europe ā stable IP without rotation.
- Configure proxies in Git config, not at the system level ā this provides precise control without affecting all traffic.
- If the account is already under suspicion ā use mobile IPs, as they almost never get blocked.
- If the account is frozen ā write to [email protected], GitHub restores access for individual developers.
- Use SSH through port 443 (ssh.github.com) ā this bypasses most provider-level blocks.
If you are looking for a reliable solution for continuous work with GitHub, we recommend considering residential proxies ā they use real IPs of home users from allowed countries, minimally attracting the attention of protection systems and providing a stable connection for Git operations. For high-load tasks (cloning large repositories, CI/CD pipelines), a good alternative would be data center proxies ā they are faster and more economical when working with large volumes of data.
```