当我使用 hexo [https://hexo.io/]在github上部署一个静态博客时,首先执行"hexo“来初始化hexo文件夹以生成如下文件和文件夹:
。
├──_config.yml
├──package.json
├──支架
├──源
_drafts├──
_posts└──
└──主题
然而,当我执行命令"hexo init“时,我发现它实际上执行git命令:
[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命令?
发布于 2016-07-14 04:57:28
在hexojs/hexo-cli/lib/console/init.js#initConsole()中,它主要执行git clone
if (args.clone) {
promise = spawn('git', ['clone', '--recursive', GIT_REPO_URL, target], {
stdio: 'inherit'
});
} else {
promise = copyAsset(target);
}然后删除git (.git)和模块(.gitmodules)。
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'
});发布于 2016-07-15 08:25:45
hexo init在这里为您提供博客的主要结构。如果git命令可用,它将执行git clone of hexo起动器存储库,否则,hexo将复制其包含hexo起动器源的子模块-资产@ 221419b。
https://stackoverflow.com/questions/38364837
复制相似问题