将网页挂载到github上(超详细)

第一步

登陆Github账号,然后创建一个远程仓库,这里我们命名为bird,创建完成后复制其ssh的URL备用




第二步

进入到bird仓库中,选择“settings”进行仓库设置,滚动到页面底部找到“Github Pages”部分:


点击“Choose a theme”选项:

点击“Select theme”对主题进行选择,完成后一个具备远程访问功能的仓库就已经设置好了,可以通过网址进行访问了。在浏览器中输入网址:https://rfhzhj.github.io/bird/即可访问到这个仓库的首页:





第三步

在本地创建映射仓库,我们在本地创建一个文件夹用于承载远程仓库的克隆体(这里我创建了名为zhj的文件夹)。打开Git Bash命令行,定位到zhj文件夹,输入克隆命令(git clone + ssh的url):git clone [email protected]:RFHzhj/bird.git;

在进行克隆的时候也可以使用https进行克隆,即输入命令(git clone + HTTPS的url):

通过点击 Use SSH 可以进行SSH和HTTPS的切换。

下面正式进行克隆:


命令执行完成后,本地文件夹zhj目录下就会有一个远程仓库的克隆体,里面有一个固定文件夹.git和其他一些默认文件,就是之前https://rfhzhj.github.io/bird/访问到的页面。


第四步

打开克隆仓库,删除除了.git以外的其他文件,上传我们自己的文件。我们先完成删除环节,删除完克隆仓库的目标文件之后,在此路径下打开github命令窗口,执行以下命令:


    
    
  1. $ git add * //把本地仓库的文件上传到缓存。
  2. $ git commit -m 'del' //把第一步上传到缓存的东西上传到本地仓库,其中'del'是操作标识,内容随便填,方便用户观看。
  3. $ git push origin master //把本地仓库的文件上传到远程仓库。

现在,我们就成功更新了远程仓库,现在仓库里什么都没有,使用网址https://rfhzhj.github.io/bird/已经访问不到。



第五步

现在我们就可以往本地仓库里面添加我们想要展示的文件啦:

然后再次执行上一步的三个命令:

完成这一步之后,远程仓库的文件就已经完成更新了,可以通过网址来访问我们想要展示的项目了。

这样我们就成功把自己的项目挂到了Github上面了。

                        <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#csdnc-thumbsup"></use>
                        </svg><span class="name">点赞</span>
                        <span class="count">5</span>
                        </a></li>
                        <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-csdnc-Collection-G"></use>
                        </svg><span class="name">收藏</span></a></li>
                        <li class="tool-item tool-active is-share"><a href="javascript:;"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-csdnc-fenxiang"></use>
                        </svg>分享</a></li>
                        <!--打赏开始-->
                                                <!--打赏结束-->
                                                <li class="tool-item tool-more">
                            <a>
                            <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                            </a>
                            <ul class="more-box">
                                <li class="item"><a class="article-report">文章举报</a></li>
                            </ul>
                        </li>
                                            </ul>
                </div>
                            </div>
            <div class="person-messagebox">
                <div class="left-message"><a href="https://blog.csdn.net/weixin_42152081">
                    <img src="https://profile.csdnimg.cn/D/3/8/3_weixin_42152081" class="avatar_pic" username="weixin_42152081">
                                            <img src="https://g.csdnimg.cn/static/user-reg-year/1x/2.png" class="user-years">
                                    </a></div>
                <div class="middle-message">
                                        <div class="title"><span class="tit"><a href="https://blog.csdn.net/weixin_42152081" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">weixin_42152081</a></span>
                                            </div>
                    <div class="text"><span>发布了15 篇原创文章</span> · <span>获赞 48</span> · <span>访问量 6万+</span></div>
                </div>
                                <div class="right-message">
                                            <a href="https://im.csdn.net/im/main.html?userName=weixin_42152081" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-letter">私信
                        </a>
                                                            <a class="btn btn-sm  bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">关注</a>
                                    </div>
                            </div>
                    </div>
    
发布了4 篇原创文章 · 获赞 4 · 访问量 7万+

第一步

登陆Github账号,然后创建一个远程仓库,这里我们命名为bird,创建完成后复制其ssh的URL备用




第二步

进入到bird仓库中,选择“settings”进行仓库设置,滚动到页面底部找到“Github Pages”部分:


点击“Choose a theme”选项:

点击“Select theme”对主题进行选择,完成后一个具备远程访问功能的仓库就已经设置好了,可以通过网址进行访问了。在浏览器中输入网址:https://rfhzhj.github.io/bird/即可访问到这个仓库的首页:





第三步

在本地创建映射仓库,我们在本地创建一个文件夹用于承载远程仓库的克隆体(这里我创建了名为zhj的文件夹)。打开Git Bash命令行,定位到zhj文件夹,输入克隆命令(git clone + ssh的url):git clone [email protected]:RFHzhj/bird.git;

在进行克隆的时候也可以使用https进行克隆,即输入命令(git clone + HTTPS的url):

通过点击 Use SSH 可以进行SSH和HTTPS的切换。

下面正式进行克隆:


命令执行完成后,本地文件夹zhj目录下就会有一个远程仓库的克隆体,里面有一个固定文件夹.git和其他一些默认文件,就是之前https://rfhzhj.github.io/bird/访问到的页面。


第四步

打开克隆仓库,删除除了.git以外的其他文件,上传我们自己的文件。我们先完成删除环节,删除完克隆仓库的目标文件之后,在此路径下打开github命令窗口,执行以下命令:


  
  
  1. $ git add * //把本地仓库的文件上传到缓存。
  2. $ git commit -m 'del' //把第一步上传到缓存的东西上传到本地仓库,其中'del'是操作标识,内容随便填,方便用户观看。
  3. $ git push origin master //把本地仓库的文件上传到远程仓库。

现在,我们就成功更新了远程仓库,现在仓库里什么都没有,使用网址https://rfhzhj.github.io/bird/已经访问不到。



第五步

现在我们就可以往本地仓库里面添加我们想要展示的文件啦:

然后再次执行上一步的三个命令:

完成这一步之后,远程仓库的文件就已经完成更新了,可以通过网址来访问我们想要展示的项目了。

这样我们就成功把自己的项目挂到了Github上面了。

                        <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#csdnc-thumbsup"></use>
                        </svg><span class="name">点赞</span>
                        <span class="count">5</span>
                        </a></li>
                        <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-csdnc-Collection-G"></use>
                        </svg><span class="name">收藏</span></a></li>
                        <li class="tool-item tool-active is-share"><a href="javascript:;"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-csdnc-fenxiang"></use>
                        </svg>分享</a></li>
                        <!--打赏开始-->
                                                <!--打赏结束-->
                                                <li class="tool-item tool-more">
                            <a>
                            <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                            </a>
                            <ul class="more-box">
                                <li class="item"><a class="article-report">文章举报</a></li>
                            </ul>
                        </li>
                                            </ul>
                </div>
                            </div>
            <div class="person-messagebox">
                <div class="left-message"><a href="https://blog.csdn.net/weixin_42152081">
                    <img src="https://profile.csdnimg.cn/D/3/8/3_weixin_42152081" class="avatar_pic" username="weixin_42152081">
                                            <img src="https://g.csdnimg.cn/static/user-reg-year/1x/2.png" class="user-years">
                                    </a></div>
                <div class="middle-message">
                                        <div class="title"><span class="tit"><a href="https://blog.csdn.net/weixin_42152081" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">weixin_42152081</a></span>
                                            </div>
                    <div class="text"><span>发布了15 篇原创文章</span> · <span>获赞 48</span> · <span>访问量 6万+</span></div>
                </div>
                                <div class="right-message">
                                            <a href="https://im.csdn.net/im/main.html?userName=weixin_42152081" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-letter">私信
                        </a>
                                                            <a class="btn btn-sm  bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">关注</a>
                                    </div>
                            </div>
                    </div>
    

猜你喜欢

转载自blog.csdn.net/weixin_44021237/article/details/104346997