简体   繁体   English

在 wsl2 windows 中设置 git

[英]Setup git in wsl2 windows

How can I setup the git in wsl?如何在 wsl 中设置 git? I cannot get it setup我无法设置它

Tried installing and setting but getting error fatal: unable to access 'https://github.com尝试安装和设置但出现fatal: unable to access 'https://github.com

  1. Download WSL and Ubuntu from Windows从 Windows 下载 WSL 和 Ubuntu
  2. Type sudo apt update 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通过sudo apt install git
  2. git config --global --add safe.directory '*'
  3. git clone your repo repository git 克隆你的 repo 存储库
  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) git config --global credential.helper store (可选存储凭据)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM