Resolving Git Proxy Issues Under WSL
First, WSL is inherently a virtual machine with its own distinct network protocol stack. Attempting to force a direct proxy connection via the host machine would be significantly more complicated; therefore, I simply utilize the host machine’s local area network (LAN) IP address to establish a local network proxy.
git config --global http.proxy http://*.*.*.*:10808
git config --global https.proxy http://*.*.*.*:10808
Additionally, SSH can be configured to utilize an HTTP proxy through connect-proxy.
apt install -y connect-proxy
Host github.com
HostName ssh.github.com
Port 443
User git
IdentityFile path/to/ssh_private_key
ProxyCommand connect-proxy -H <Proxy IP>:<port> %h %p
Resolving Slow PowerShell Startup Loading Speeds
Accelerating PowerShell startup time from 1418ms to near-instantaneous launch.
Problem:
“Loading personal and system profiles took 1418ms.” The Conda initialization block located within D:\UserName\Documents\PowerShell\profile.ps1 invokes conda.exe upon every startup; this process is further slowed down by Windows Defender scans.
Solution:
Delete the Conda initialization code block (spanning 5 lines, from
#regionto#endregion) located withinD:\UserName\Documents\PowerShell\profile.ps1.Add-MpPreference -ExclusionProcess "pwsh.exe"Add-MpPreference -ExclusionPath "D:\Software\PowerShell\7"Add-MpPreference -ExclusionPath "D:\UserName\Documents\PowerShell"[System.Environment]::SetEnvironmentVariable('POWERSHELL_UPDATECHECK', 'Off', 'User')The
cnfunction remains withinMicrosoft.PowerShell_profile.ps1; simply typecnto activate Conda. Final Configuration
# 1. Forcefully disable PowerShell's network check for updates at startup (saves a few hundred milliseconds)
$env:POWERSHELL_UPDATECHECK = 'Off'
# 2. Define a function to load Conda on demand
# In the future, whenever you want to use Conda, simply type 'cn' in the terminal.
# It remains unloaded during normal use, ensuring the terminal launches instantly.
function cn {
$Env:CONDA_EXE = "path/to/Anaconda3\Scripts\conda.exe"
$Env:_CE_M = ""
$Env:_CE_CONDA = ""
$Env:_CONDA_ROOT = "path/to/Anaconda3"
$Env:_CONDA_EXE = "path/to/Anaconda3/Scripts/conda.exe"
$CondaModuleArgs = @{ChangePs1 = $True}
# This heavyweight module is only imported when the 'cn' command is executed.
Import-Module "$Env:_CONDA_ROOT\shell\condabin\Conda.psm1" -ArgumentList $CondaModuleArgs
Remove-Variable CondaModuleArgs
Write-Host "--- Conda environment activated ---" -ForegroundColor Green
}
git Reporting File Modifications Due to Linux vs. Windows Line Endings
Create .gitattributes
* text=auto
*.cpp text eol=lf
*.h text eol=lf
*.c text eol=lf
*.hpp text eol=lf
*.txt text eol=lf
*.md text eol=lf
*.json text eol=lf
*.xml text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.sh text eol=lf
Makefile text eol=lf
*.sln text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf
*.vcxproj.user text eol=crlf
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.exe binary
*.dll binary
*.lib binary
git add --renormalize .
git commit -m "build: force all text files to LF for cross-platform consistency"