I met some problems when I downloaded some files from GitHub on WSL2. I cannot download files when I connect to GitHub directly. So, I try to use a proxy to solve the problem. I have tried serval solutions which do not work.

Now, there is a way to solve the problem with the following content.

# Preparation:

1. Open the function of Allow LAN in your proxy software.

2. Get the port(eg. Clash’s default port is 7890) of the proxy.

# Solution:

1. Add the following code at the end of .bashrc

2. Enabling environment variables

3. Now, you can use the following command to activate proxy and deactivate proxy in shell.

And have a nice day!