2023年9月

家里装了移动送的300Mbps宽带,8月份特殊时期结束以后,突然发现Github的代码提交成了一大难点,还是用了VPN等方式,仍然存在概率性问题。特此记录此方法。

1、查找真实IP

Github网站可以打开,但是提交代码就不行。先查看ssh.github.com 这个域名对应的ip是哪个?

这个可以直接在 https://ipaddress.com/website/ssh.github.com。查到该ip。

2023-09-16_225415.png

2、查找该IP是否可用。

ssh -T -p 443 [email protected]
The authenticity of host '[140.82.114.36]:443 ([140.82.114.36]:443)' can't be established.
ECDSA key fingerprint is SHA256:p2QA
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[140.82.114.36]:443' (ECDSA) to the list of known hosts.
XXXXXX

到此基本可以确定为有用的了,则进行配置直接访问该地址

3、这时候,找到当前用户目录下的.ssh/config 文件,如果没有就自己建一个。只要将Hostname ssh.github.com换成ip地址140.82.112.35即可。

Host github.com
Hostname 140.82.112.35
Port 443


基于Python在Win环境下总是出现各类问题,想着采用新的WSL环境来部署运行Python项目。

一、安装WSL系统,参考微软官方教程

wsl --install

安装完成后即可等待重启,然后运行Unbutu,首次会提示初始化,并设置用户名和密码,之后可在计算机里看到Linux目录。

二、安装pip等工具

Unbutu系统自带了python3,但是发现无pip命令,执行安装(sudo apt install python3-pip)时报错,报错如下

Package python3-pip is not available but is referred to by another package.
This may mean that the package is missing, has been obsoleted, oris only available from another source
E: Package 'python3-pip' has no installation candidate

执行以下命令后,即可

sudo apt-get update
sudo apt-get upgrade  #Optional
sudo apt install python3-pip

三、后续安装virtualenv时会提示警告,导致无法使用该命令

WARNING: The script virtualenv is installed in '/home/desk/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

解决方案如下:

echo 'export PATH=$PATH:$HOME/.local/bin' >>~/.bashrc
source ~/.bashrc