首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >"hexo init <folder>“到底做什么git命令?

"hexo init <folder>“到底做什么git命令?
EN

Stack Overflow用户
提问于 2016-07-14 03:06:34
回答 2查看 320关注 0票数 1

当我使用 hexo [https://hexo.io/]在github上部署一个静态博客时,首先执行"hexo“来初始化hexo文件夹以生成如下文件和文件夹:

├──_config.yml

├──package.json

├──支架

├──源

_drafts├──

_posts└──

└──主题

然而,当我执行命令"hexo init“时,我发现它实际上执行git命令:

代码语言:javascript
运行
复制
  [root@localhost buwei]# hexo init blog
  INFO  Cloning hexo-starter to /home/buwei/blog
  Cloning into '/home/buwei/blog'...
  remote: Counting objects: 53, done.
  remote: Total 53 (delta 0), reused 0 (delta 0), pack-reused 53
  Unpacking objects: 100% (53/53), done.
  Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme-      landscape.git) registered for path 'themes/landscape'
  ....

所以我想知道"hexo init“执行什么git命令?

EN

回答 2

Stack Overflow用户

发布于 2016-07-14 04:57:28

hexojs/hexo-cli/lib/console/init.js#initConsole()中,它主要执行git clone

代码语言:javascript
运行
复制
  if (args.clone) {
    promise = spawn('git', ['clone', '--recursive', GIT_REPO_URL, target], {
      stdio: 'inherit'
    });
  } else {
    promise = copyAsset(target);
}

然后删除git (.git)和模块(.gitmodules)。

代码语言:javascript
运行
复制
  return promise.catch(function() {
    log.warn('git clone failed. Copying data instead');

    return copyAsset(target);
  }).then(function() {
    return Promise.all([
      removeGitDir(target),
      removeGitModules(target)
    ]);
  }).then(function() {
    if (!args.install) return;

    log.info('Install dependencies');

    return spawn('npm', ['install', '--production'], {
      cwd: target,
      stdio: 'inherit'
});
票数 2
EN

Stack Overflow用户

发布于 2016-07-15 08:25:45

hexo init在这里为您提供博客的主要结构。如果git命令可用,它将执行git clone of hexo起动器存储库,否则,hexo将复制其包含hexo起动器源的子模块-资产@ 221419b

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38364837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档