在github上建立自己的网站

本文介绍如何在五分钟内通过GitHub Pages快速搭建个人网站。包括GitHub账号注册、创建符合规范的仓库、上传HTML文件等内容,并提供了基本的Git命令操作指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

整个过程只要五分钟,真的只要五分钟。

当然之前需要准备网站的文件,

根据需要建立自己网站,图片什么的是需要自己做的。

最重要的是开始有个index,html文件,这是网站的入口,下面是具体的操作。

首先得有个github账号,github账号注册。

然后创建一个仓库,

仓库的命名有规则

name.github.io

记住是github.io结尾。

整个过程只要记住两部,第一是.html结尾,第二是.github.io结尾。

讲要使用的网站拖到仓库中,加载完成,

怎么建立网站,看之前的三篇博客。

然后输入网址进行验证

https://wangrling.github.io/test-site/

成功

同步本地和远程代码

正确的做法是下面这样的。

首先是git clone https://wangrling.github.io/test-site/

下载你要的代码

修改你想要改的代码,随便用什么编辑器都可以。

git add .

git commit -m tag 加入你想要的信息。

git push

推送到远程的库中。

输入用户名和密码。

完成。

  • git clone <address>:复制代码库到本地。
  • git add <file> ...:添加文件到代码库中。
  • git rm <file> ...:删除代码库的文件。
  • git commit -m <message>:提交更改,在修改了文件以后,使用这个命令提交修改。
  • git pull:从远程同步代码库到本地。
  • git push:推送代码到远程代码库。
  • git branch:查看当前分支。带*是当前分支。
    • git branch <branch-name>:新建一个分支。
    • git branch -d <branch-name>:删除一个分支。
  • git checkout <branch-name>:切换到指定分支。
  • git log:查看提交记录(即历史的 commit 记录)。
  • git status:当前修改的状态,是否修改了还没提交,或者那些文件未使用。
  • git reset <log>:恢复到历史版本。

web工作原理

  1. The browser goes to the DNS server and finds the real address of the server that the website lives on (you find the address of the shop).
  2. The browser sends an HTTP request message to the server asking it to send a copy of the website to the client (you go to the shop and order your goods). This message, and all other data sent between the client and the server, is sent across your internet connection using TCP/IP.
  3. Provided the server approves the client's request, the server sends the client a "200 OK" message, which means "Of course you can look at that website! Here it is", and then starts sending the website's files to the browser as a series of small chunks called data packets (the shop gives you your goods, and you bring them back to your house).
  4. The browser assembles the small chunks into a complete website and displays it to you (the goods arrive at your door — new stuff, awesome!).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值