Skip to content

Instantly share code, notes, and snippets.

View 411A's full-sized avatar
:octocat:
🐱‍💻

AlI 411A

:octocat:
🐱‍💻
View GitHub Profile
@411A
411A / FixWSLTime.sh
Last active February 8, 2023 10:23
Fix WSL2 & Windows 11 Time Syncing Issue. This bash app will sync the time of WSL & Windows after computer goes to sleep using two approaches: hwclock & wsl --shutdown
#!/bin/bash
# -------------------- A temporary-manual-notgreat fix for the time syncing problem between Windows & WSL --------------------
# -------------------- Please read the code & commented sections before execution --------------------
# Not removing the trailing \r from the PowerShell, results in NotSynced even if time is Synced
WinTime=$(powershell.exe "& {get-date -UFormat '%Y/%m/%d %H:%M:%S'}" | tr -d '\r')
WSLTime=$(date +"%Y/%m/%d %H:%M:%S")
RED="\033[0;31m"

Creates the related GitHub's SSH configuration on drive C.

  1. Create a new directory to store your credentials inside the C drive (/), then create a hidden .ssh directory inside it:
# Create directories
mkdir "/MyGitHub"
cd "/MyGitHub"
mkdir ".ssh"
# Create a new config file
New-Item "/MyGitHub\.ssh\config" -ItemType "file"