之前一直用编译服务器来管理项目,gitthub不需要确认,默认直接merge,记录一下如何使用github来管理平时的小项目。
准备工作:
1.首先确保自己电脑已经安装Git桌面端。
git下载地址:https://git-scm.com/downloads
2.注册github账户
步骤:
1.点击File—>Settings—>Version Control—>Git
2.点击File—>Settings—>Version Control—>GitHub
登录自己的github账户。
3.点击VCS—>Import into Version Control—>Share Project on Github,上传你的项目到github上。
上传失败ERROR记录:
but initial commit failed: *** 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. unable to auto-detect email address (got ‘zxl@DESKTOP-0DG220I.(none)’)
A:忘记配置git的问题
全局配置git=,运行git bash,添加以下两行代码:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
单独为项目配置的方法(全局和单独配置都存在的时候会默认使用项目单独配置的):
1.打开项目所在目录,找到隐藏的.git文件夹。注意这个文件夹是隐藏的,显示隐藏出来就行。
2.打开文件夹里的config文件,推荐用nodepad++打开。
3.添加这三行到文件:
[user]
name = XXX(自己的名称)
email = XXXX(邮箱)
在github上删除失败提交的代码,Setting页面的最后一项,重新提交。
提交修改单个文件
单击修改的文件。git—>Add,将项目文件添加到git
Git——>Commit File,将代码commit到本地仓库,选择要提交的文件并写下描述
最后push提交。
测试成功。