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


如题,我本地有一个_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

github git

炎D妖精诺露琪 11 years, 4 months ago

你那上面的输出信息一直再说工作目录是干净的,没什么可 commit 的。要么是你目录下没有文件,要么是你已经执行过一次 commit ,之后没有再次修改或添加过文件。你可以:

  1. _posts 下创建一个文件
    touch _posts/README.md
  2. 添加到Git
    git add _posts
  3. 添加操作信息
    git commit -m '创建_posts/README.md文件
一个人撸管 answered 11 years, 4 months ago

你的工作目录对吗

♂呵♂呵♂ answered 11 years, 4 months ago

github默认不允许push非空文件夹,所以你只add一个空文件夹是push不上去的。

2276215 answered 11 years, 4 months ago

你有没有 git commit -a ?不添加 commit ,是push不上去的。

喵了个咪咪 answered 11 years, 4 months ago

Your Answer