Setup git in wsl2 windows

How can I setup the git in wsl? I cannot get it setup

Tried installing and setting but getting error
fatal: unable to access 'https://github.com

>Solution :

  1. Download WSL and Ubuntu from Windows
  2. Type sudo apt update
  3. Type

sudo touch /etc/resolv.conf

sudo chmod 777 /etc/resolv.conf

sudo printf 'nameserver 8.8.8.8\nnameserver 4.4.4.4' > /etc/resolv.conf

  1. Install git by sudo apt install git
  2. git config --global --add safe.directory '*'
  3. git clone your repo repository
  4. Add your credentials by using a personal token as password is outdated
  5. git config --global credential.helper store (optional to store the credentials)

Leave a Reply