- 本地安装git
- git基本配置
- vscode的操作方法
一、本地安装git:https://git-scm.com/downloads
选择安装路径
选择组件
On the Desktop 在桌面上
Windows Explorer integration Windows资源管理器集成鼠标右键菜单
Git LFS (Large File Support)大文件支持
Associate .git* configuration files with the default text editor将 .git 配置文件与默认文本编辑器相关联
Associate .sh files to be run with Bash将.sh文件关联到Bash运行
Use a TrueType font in all console windows在所有控制台窗口中使用TrueType字体
Check daily for Git for Windows updates每天检查Git是否有Windows更新
创建开始菜单目录
使用 Visual Studio Code 作为 Git 的默认编辑器
Use the Nano editor by default
默认使用 Nano 编辑器
Use Vim (The ubiquitous text editor) as Git’s default editor
使用 Vim 作为 Git 的默认编辑器
Use Notepad++ as Git’s default editor
使用 Notepad++ 作为 Git 的默认编辑器
Use Visual Studio Code as Git’s default editor
使用 Visual Studio Code 作为 Git 的默认编辑器
其他使用傻瓜式安装即可。
二、git配置
给git配置全局环境变量
选择一个项目,打开控制台:
Git 全局设置:
git config --global user.name "ASxx"
git config --global user.email "[email protected]"
创建 git 仓库:
mkdir wap // 项目在本地的路径
cd wap
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://git.oschina.net/name/package.git // 远程仓库地址
git push -u origin master
已有项目:
cd existing_git_repo
git remote add origin https://git.oschina.net/name/package.git
三、vscode操作
配置vscode
点击红色框按钮,进入git模式
修改文件,左侧更改栏显示更改;
点击红色标记,则内容保存至暂存的更改,add成功:
点击对勾号,则弹出2,输入提交描述,点击enter,则commit成功:
点击左侧三个点按钮,弹出弹出框,点击推送,则上传至git:
若想从git拉取代码,则点击"拉取"按钮即可,其他相关按钮操作,有兴趣的可以自行研究。