git:本地有的文件夹push到github上之后却看不到

 雨天是最美 发布于 2022-10-25 08:05

如题,我本地有一个_posts文件夹,但是我做了一些修改后再push到github上却看不到这个文件夹了,请问这是怎么回事,应该如何修复呢?

git status的输出如下:On branch gh-pages

Your branch is up-to-date with 'origin/gh-pages'.

nothing to commit, working directory clean

然后操作

   git add _posts
   git status

输出:

  On branch gh-pages
  Your branch is up-to-date with 'origin/gh-pages'.nothing to commit,             working directory clean

git commit -a的输出

On branch gh-pages
Your branch is up-to-date with 'origin/gh-pages'.
nothing to commit, working directory clean

执行git rm -r _posts后有如下输出:

fatal: pathspec '_posts' did not match any files
4 个回答
  • 你那上面的输出信息一直再说工作目录是干净的,没什么可commit的。要么是你目录下没有文件,要么是你已经执行过一次commit,之后没有再次修改或添加过文件。你可以:

    1. _posts下创建一个文件
      touch _posts/README.md
    2. 添加到Git
      git add _posts
    3. 添加操作信息
      git commit -m '创建_posts/README.md文件
    2022-10-26 14:32 回答
  • 你的工作目录对吗

    2022-10-26 14:32 回答
  • 你有没有git commit -a?不添加commit,是push不上去的。

    2022-10-26 14:32 回答
  • github默认不允许push空文件夹,所以你只add一个空文件夹是push不上去的。

    2022-10-26 14:33 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有