git前期准备
git小结
设置用户名
git config –global user.name ‘itcast’
设置用户名邮箱
git config –global user.email ‘itcast’
查看设置
git config –list
查看状态
git status
创建文件路径
mkdir demo1
在文件夹内初始化git(创建git仓库)
cd demo1
git init
提交文件
工作区→暂存区→Git仓库
git commit –m “提交描述”
git status
git add hello.php
git add test.php
修改文件
vi a1.php
删除文件
- 删除文件
rm test.php - 从Git中删除文件
git rm test.php - 提交操作
git commit –m “提交描述”
rm –rf a1.php
使用远程仓库的目的
作用:备份,实现代码共享集中化管理
将本地仓库提交到远程仓库
git push
Git克隆操作
目的
将远程仓库(github对应的项目)复制到本地
git push
创建文件
git touch a1.php
代码
git clone 仓库地址
仓库地址即克隆地址
查看git配置
git config --list
解决git push错误
个人站点
搭建步骤
1、创建个人站点->新建仓库(注:仓库名必须是【用户名.github.io】)
2、在仓库下新建index.html即可
注意:
1、 github pages 仅支持静态网页
2、 仓库里面只能是.html文件
Project Pages项目站点
https://用户名.github.io/仓库名
搭建步骤
1、 进入项目主页,点击settings
2、 在settings页面,点击【Launch automatic page generator】来自动生成主题页面
3、 新建站点基础信息设置
4、 选择主题
5、 生成网页