Hexo主题themes-文件夹无法提交到GitHub的解决方法

好久没写博客了
最近在家里闲着无聊想把hexo搭建的博客用git来托管实现电脑的同步管理
以前都是在笔记本电脑里写 现在回到家更喜欢用台式机
so 就有了这样的想法 🆗 现在开始折腾

一、遇到的问题

因为themes/hexo-theme-icarus也是从仓库里拉取下来的 他关联到了作者的git仓库
所以提交不上去

C:\Users\WeiLin\Desktop\weilin-liao.github (master -> origin)
λ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
        modified:   themes/hexo-theme-icarus (modified content, untracked content)

no changes added to commit (use "git add" and/or "git commit -a")

二、解决方案

  1. 从暂存区删除该文件夹

    git rm --cache themes/主题文件名
    

    比如我的是主题是 hexo-theme-icarus

    git rm --cache themes/hexo-theme-icarus
    

themes/hexo-theme-icarus/.git文件夹到放到位置 比方说桌面
记得把 themes/hexo-theme-icarus/.gitignore里的 _config去掉

  1. git status查看当前状态

    C:\Users\WeiLin\Desktop\weilin-liao.github (master -> origin)
    λ git status
    On branch master
    Your branch is up to date with 'origin/master'.
    
    Changes to be committed:
      (use "git restore --staged <file>..." to unstage)
            deleted:    themes/hexo-theme-icarus
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
            themes/
    
  2. 直接按步骤提交就行了

    git add .
    git commit -m "add themes"
    git push
    

    后面再把刚刚的.git文件夹移动回去

    🆗🆗折腾完了 干饭去了

    更多内容关注我的博客 https://xiaobaicai.fun

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值