hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.28k stars 4.83k forks source link

how to change the git config which hexo uses when deploying ! #1281

Closed xirong closed 9 years ago

xirong commented 9 years ago

git config 有三種,system、global、local,我本機上有公司級別的gitlav,有外網的github,還有大陸的gitcafe,user.name 和 user.email 都不同,提交少的repository我選擇在本身修改local config來更改用戶名、用戶郵箱,請問 hexo deploy 使用的一定要是global的config中配置嗎?(中文不知道你能不能看懂,寫個蹩腳的英文)there is system,global,local three kind in git config , i usually change the local config to fit every situation , but where is the config when hexo deploying ?

Xuanwo commented 9 years ago

实际上,如果使用hexo-deployer-git的话,原理就是命令行调用git,理论上来讲,只要修改好自己对应的库的相关信息,就可以正常工作。你可以去看看hexo-deployer-git插件的相关源码。

Xuanwo commented 9 years ago

你可以自己写脚本来处理,不要使用hexo deploy。 比如说,分别建立.gitlav.github以及.gitcafe,然后把public下的所有文件复制到他们中,然后执行git push --force

xirong commented 9 years ago

@Xuanwo 嗯,你说的方法是可以的,我目前是这么做的,global config 中我设置的为github的账户,这样参与github上面的东西是不需要任何改动的,每个gitlab的文件夹中(其实公司的repo真的不多)设置local config里面设置公司的账户,这样子就是ok的。只不过,每次公司有新的repo需要clone的时候,需要先设置下 local config,稍微有些麻烦。