1.下载安装git
记住安装路径
2.在vscode中配置git
选择settings
在输入框中输入git.path,打开文件。
修改填入自己的git路径,是文件git.exe所在路径。
然后关闭 VScode ,重启VScode。
3.clone 仓库
重启后点击source control,选择clone Repository。
=========================================================================
git 掉线后修复
-
打开项目: 在 VS Code 中打开您要上传至 GitHub 的项目。
-
初始化 Git 仓库: 如果项目尚未是一个 Git 仓库,您需要在项目文件夹中打开终端并执行以下命令:
git init
-
添加文件到暂存区: 执行以下命令将项目文件添加到 Git 的暂存区:这会将当前目录下的所有文件添加到暂存区。
git add .
-
提交更改: 执行以下命令提交暂存区的更改到本地仓库:替换 "Your commit message here" 为您的提交信息。
git commit -m "Your commit message here"
-
Terminal提示,根据提示输入email和username
*** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'yangy@LAPTOP-TGP6NUK5.(none)') PS F:\fundDataSample> git config --global user.email "email" PS F:\fundDataSample> git config --global user.name "username" PS F:\fundDataSample> git commit -m "ui_input"
再次commit
git commit -m "your commit message"
-
连接到 GitHub 仓库: 在 GitHub 上创建一个新的仓库,然后执行以下命令将本地仓库与远程 GitHub 仓库关联起来:将
<GitHub repository URL>
替换为您的 GitHub 仓库的 URL。git remote add origin <GitHub repository URL>
-
推送到 GitHub: 执行以下命令将本地仓库的更改推送到 GitHub:这会将本地的
master
分支推送到 GitHub 上的master
分支。如果您希望将其他分支推送到 GitHub,可以将master
替换为您要推送的分支名称。git push -u origin master
-
输入凭据: 当您执行
git push
命令时,Git 可能会提示您输入 GitHub 的用户名和密码来验证推送操作。