Problem description

An error occurs when you run the following command to clone the target source code locally.

git clone https://github.com/RoboCup-SSL/technical-challenge-rules.git
Copy the code

Error: Cloning into ‘technical-challenge-rules’… fatal: unable to access ‘https://github.com/RoboCup-SSL/technical-challenge-rules.git/’: Failed to connect to x.x.x.x port xxxx: Connection refused

In accordance with thewpyily|CSDNMethod, the clone address header byhttps://Instead ofgit@, can be cloned successfully. But it’s a hassle to pay attention to that every time. So, find the root cause of the problem and find a solution. The solution is described in the next section.

The solution

Thank predecessors’ experience (tsq292978891 | CSDN, as well as the promise day | sina blog).

Tsq292978891 | CSDN on its blog, points out the root cause of the problem: the reason is X.X.X.X port XXXXX is occupied by a as a proxy, need to restart!!!!!!

Explanation: I often need scientific Internet access because of scientific research reasons, so set up an agent.

  • 1. Run a command to view the proxy Settings
 env|grep -i proxy 
Copy the code
NO_PROXY = localhost, 127.0.0.0/8: : 1 http_proxy https_proxy = = http://127.0.0.1:46759/ http://127.0.0.1:46759/ HTTPS_PROXY = http://127.0.0.1:46759/ no_proxy = localhost, 127.0.0.0/8, : : 1 HTTP_PROXY = http://127.0.0.1:46759/Copy the code

The result varies from person to person. If the port number of the proxy is the same as the IP address and port number displayed in the error, it is occupied by the proxy. You need to unset all proxies related to the port number displayed in the error.

  • 2. Execute the following four commands in sequence to cancel the occupied agent
unset http_proxy
Copy the code
unset  https_proxy
Copy the code
unset   HTTPS_PROXY
Copy the code
unset   HTTP_PROXY
Copy the code
  • Git clone https://

  • 4. And then… I found that every time I started a new window and git clone failed, I found that the proxy appeared again under the new port and occupied that port. I couldn’t find out where the proxy was set up, so I didn’t dare mess around. Git Clone: Git Clone: git Clone: git Clone: git Clone: git Clone: Git Clone: Git Clone: Git Clone: Git Clone: Git Clone: Git Clone

Open the.bashrc file

gedit ~/.bashrc
Copy the code

Adds a line at the end of the red box