Windows下如何用git连接远程仓库

在本地新建一个git仓库

1.在某路径下git bash
Windows下如何用git连接远程仓库
例如本教程选择E盘,鼠标右键点击Git Bash Here

2.在打开的终端里设置global user.name 与 global user.email

$ git config --global user.name “your name”

$ git config --local user.email “your email”

可通过如下指令查看设置是否成功

$ git config --global --list
Windows下如何用git连接远程仓库

3.在该路径下新建一个文件夹(本教程是E盘下),并进入该文件夹下的路径进行下一步设置

//初始化本地git仓库
$ git init

Windows下如何用git连接远程仓库

$ git conig --local user.name “your name”

$ git config --local user.email “your email”

可通过如下指令查看设置

$ git config --local --list
Windows下如何用git连接远程仓库

关联远程仓库

$ git remote add origin 远程仓库地址

可通过如下指令查看是否关联成功,如下图所示即关联成功

$ git remote -v
Windows下如何用git连接远程仓库

pull远程仓库的代码

$ git pull origin master