layout: post author: zoomq title: 如何在M$系统中管理 Gitcafe 的Pages 内容发布? description: ~ 基于 msysgit,在M$ 系统中使用Git 来管理 Gitcafe 的Pages 发布Blog! categories: Howto tags: git gitcafe pages


msysgit-logo.png(PNG 图像,220x256 像素) 为杯具的 M$ 环境,一键式提供了 git 环境!

那么如何使用 gitcafe 提供的 pages 服务?

整体思路,参考:

Gitcafe 中发布 Pages 也是同样的过程:

强调一下思路

{% highlight bash %} 2012-12-19-usage-msysgit-make-pages.md | | | | +- 后綴名指使用 Markdown 语法的结构化纯文本 | | | +- 以减号间隔开始的有意义的E文 文章名,将成为访问时的URL 一部分 | | +- 日期 | +- 月份 +- 年份

{% endhighlight %}

以及文本的前几行使用固定格式来声明一些文章信息:

{% highlight bash linenos %}

layout: post title: 如何在M$系统中管理 Gitcafe 的Pages 内容发布? description: ~ 基于 msysgit,在M$ 系统中使用Git 来管理 Gitcafe 的Pages 发布Blog! categories: Howto tags: git gitcafe pages


...正文 {% endhighlight %}

具体说明:

  1. --- 约定控制标识符
  2. layout: 指出使用哪个模板,不要修改!除非你知道怎么回事儿!
  3. title: 文章标题
  4. description: 简述,有的模板首页只有简述没有正文的,输出的就是这儿的文字
  5. categories: 分类标签,使用空格区分多个
  6. tags: 内容标签,使用空格区分多个
  7. --- 约定控制标识符
  8. 最好有个空行同正文分开

注意!!! ~ 所有的配置声明格式为: 变量:+空格+配置内容 ,少了空格会引发各种问题的!

以上就是写文章所要知道的一切了,以下所有配置什么的, 99% 都是为了在 M$ 中使用 git 而已...

安装 msysgit 整备环境

0-bash.png

命令形如: {% highlight bash %} bash-3.1$ ssh-keygen -C "zhouqi@ijinshan.com" Your identification has been saved in /c/Documents and Settings/Administrator/.s sh/id_rsa. Your public key has been saved in /c/Documents and Settings/Administrator/.ssh/i d_rsa.pub. The key fingerprint is: cf:1b:90:1b:25:0a:12:61:ff:ad:71:d0:ec:cd:5f:55 zhouqi@ijinshan.com

{% endhighlight %}

00-cafe-pubkey

再由仓库管理员加 gitcafe 帐号为 blogging 仓库的协作人员:

04-cafe-team

并在本地配置合理的全局变量: {% highlight bash %} bash-3.1$ git config --global user.name "zhouqi" bash-3.1$ git config --global user.email "zhouqi@ijinshan.com" {% endhighlight %}

可以使用git 命令观察是否生效: {% highlight bash %} bash-3.1$ git config --list

...

http.sslcainfo=/mingw/bin/curl-ca-bundle.crt sendemail.smtpserver=/mingw/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true user.name=zhouqi user.email=zhouqi@ijinshan.com {% endhighlight %}

使用 git 命令初始化本地工作仓库

从仓库首页可以获得有写入权限的 URI:

00-gituri.png

在合适的空白目录中 clone 远程仓库到本地,并同时切换为指定的 gitcafe-pages 分支:

{% highlight bash %} bash-3.1$ pwd /c/msysgit

bash-3.1$ git clone --branch gitcafe-pages git@gitcafe.com:Liebao/Liebao.git blog Cloning into 'blog'... The authenticity of host 'gitcafe.com (50.116.2.223)' can't be established. RSA key fingerprint is 84:9e:c9:8e:7f:36:28:08:7e:13:bf:43:12:74:11:4e. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'gitcafe.com,50.116.2.223' (RSA) to the list of known hosts. remote: Counting objects: 127, done. remote: Compressing objects: 100% (122/122), done. remote: Total 127 (delta 47), reused 0 (delta 0) Receiving objects: 100% (127/127), 458.50 KiB | 377 KiB/s, done. Resolving deltas: 100% (47/47), done. {% endhighlight %}

在资源管理器中就可以见到整个基于 jekyll 的团队blog 工程了!

2-cloned.png

推荐配置

在 git 配置文件中声明有意义的别名:

修订 仓库目录中 .git/cofig 文件 - 即,如果 clone 的仓库目录是 C:\msysgit\blog - 则,仓库配置文件就在 C:\msysgit\blog\.git

默认内容类似: {% highlight ini %} [remote "origin"] url = git://gitcafe.com/Liebao/Liebao.git fetch = +refs/heads/:refs/remotes/origin/ [branch "master"] remote = cafe merge = refs/heads/master {% endhighlight %}

追加一节: {% highlight ini %} [remote "cafe"] url = git@gitcafe.com:Liebao/Liebao.git fetch = +refs/heads/:refs/remotes/origin/ {% endhighlight %}

1-config.png

使用 markdownpad 进行文章编辑

3-markdownpad.png

编辑保存后,使用 status 可以观察到变化: {% highlight bash %} bash-3.1$ git status

On branch gitcafe-pages

Changes not staged for commit:

(use "git add ..." to update what will be committed)

(use "git checkout -- ..." to discard changes in working directory)

modified: _posts/2012-12-10-git-note.md

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

使用 add 收录变更,才能 commit, 最后 push 后,才能发布到 gitcafe 的团队仓库: {% highlight bash %} bash-3.1$ git add .

bash-3.1$ git commit -m "zhouqi throught XP + msysgit" [gitcafe-pages 6f50b04] zhouqi throught XP + msysgit 1 file changed, 4 insertions(+)

bash-3.1$ git push cafe warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git)

Counting objects: 7, done. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 426 bytes, done. Total 4 (delta 3), reused 0 (delta 0) To git@gitcafe.com:Liebao/Liebao.git 89db4d6..6f50b04 gitcafe-pages -> gitcafe-pages {% endhighlight %}

11-cafe-same

技巧: 图形化版本树!

{% highlight bash %} bash-3.1$ git log --graph --pretty=oneline --abbrev-commit 59a267c 快速使用 README 教程M$+SourceTree 使用 3fa9827 Merge branch 'gitcafe-pages' of gitcafe.com:Liebao/Liebao into gitcafe-pages |\
| * 6f50b04 zhouqi throught XP + mysysgit | * 89db4d6 使用协作人員的身份对仓库进行 add+ci | 2d7c376 before merge ci 先 |/
f20f7ef 根据协同过程,增补使用说明+++格式追加分层 7e9496e 根据协同过程,增补使用说明++ 5f1e4bf 根据协同过程,增补使用说明 80846ab 演示多人协同时的流程+ e8b5e0f Merge branch 'gitcafe-pages' of gitcafe.com:Liebao/Liebao into gitcafe-pages |\
| * 9783bab 尝试另外成员本地的协同过程 | ce33b2e 增补res 目录,准备发布可能的幻灯资料.. |/
61f39ee 增补本地图片使用样例 ... {% endhighlight %}

121219-git-ll

小结

总之使用 git+gitcafe pagesM$ 中的日常操作命令只有:

  1. git clone --branch gitcafe-pages ...
  2. git add .
  3. git commit -a -m "注释"
  4. git push cafe gitcafe-pages
  5. git pull cafe gitcafe-pages

而基础协同流程就两种:

参考



以上...


码不停提马上无虫 ;-)

|_|0|_|
|_|_|0|
|0|0|0|

加入 珠海GDG

  1. 注册 G+
  2. 关注 GDG Zhuhai
  3. 成为 GDG Zhuha开发者

通过 珠海GDG 可以:

    第一时间获知谷歌最新的技术,
    可以学到如何去谷歌平台上赚钱的思路和方法,
    可以认识很多有可能将来一起走上自己创业道路的人,
    可以学会把你的创新带向国际市场,
    参加那里的活动有经常和国际上的开发者们进行交流的机会...

PS:

若无意外,题图都是从原文提取或是通过 Google 图片搜索出来的, 版权属左, 不负责任 ;-)

PPS:

珠海GDG wechat/Blog 都是欢迎投稿的,只要追认内容吻合以下条件:

0. 有趣 ~ 至少是自个儿有兴趣的领域吧...
1. 有料 ~ 至少有点儿原创的东西吧..
2. 有种 ~ 至少不能是成功学吧!

有好物的,及时向大妈们吼: support@zhgdg.org

微信栏目

当前应该是:

    G术图书 (gb:推荐好书,书无中外)
    D码点评 (dd:麻辣评点,善意满盈)
    G说公论 (gt:时评杂文,新旧不拘)
    珠的自白(dm:大妈自述,每周一篇)
    海选文章(hd:得要相信,大妈法眼)

总之! 珠海的组委大妈们,决定开始坚持发文,方方面面细细同大家分享/交流

总之! 请大家告诉大家, 珠海生活中的技术社区 已经认真回归 微信,都来订阅吧!

订阅方法

GDG珠海 社区资源:


Author: Zoom.Quiet /mail / gittip / github