ZoomQuiet / OMOOC2py

开智学院.Python入门班 第二期
MIT License
4 stars 4 forks source link

[0wd5]dpush #1

Open ZoomQuiet opened 8 years ago

ZoomQuiet commented 8 years ago

~ 是什么以及为什么

现象

~ 本质上由于 gitbook NoZuoNoDie 的行径,导致以往的自然流程失效:

已知:

目标:

所以:

github

gitbook

技巧:

[remote "origin"]
    url = git@github.com:OpenMindClub/[图书名].git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "book"]
    url = https://git.gitbook.com/[帐号]/[图书名].git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "hub"]
    url = git@github.com:OpenMindClub/[图书名].git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "origin"]
    url = git@github.com:OpenMindClub/[图书名].git
    fetch = +refs/heads/*:refs/remotes/origin/*
$ git remote -v
book    https://git.gitbook.com/[帐号]/[图书名].git (push)
book    https://git.gitbook.com/[帐号]/[图书名].git (fetch)
hub git@github.com:OpenMindClub/[图书名].git (push)
hub git@github.com:OpenMindClub/[图书名].git (fetch)
origin  git@github.com:OpenMindClub/[图书名].git (push)
[remote "book"]
    url = https://[用户名]:[口令]@git.gitbook.com/[帐号]/[图书名].git
    fetch = +refs/heads/*:refs/remotes/origin/*

那么,俺就可以用两次 git 操作,完成两个仓库的内容发送了:

$ git pu hub
Counting objects: 18, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (16/16), 3.29 KiB | 0 bytes/s, done.
Total 16 (delta 3), reused 0 (delta 0)
To git@github.com:OpenMindClub/[图书名].git
   8c3c8b6..f27428a  master -> master

$ git pu book
Counting objects: 20, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (16/16), 3.29 KiB | 0 bytes/s, done.
Total 16 (delta 3), reused 0 (delta 0)
To https://[用户名]:[口令]@git.gitbook.com/[帐号]/[图书名].git
   8c3c8b6..f27428a  master -> master

自动双推

经过文档研究,发现,其实, git 可以任性的识别仓库配置中,多个 uri 的,那么增强配置为

...
[remote "origin"]
    url = https://[用户名]:[口令]@git.gitbook.com/[帐号]/[图书名].git
    url = git@github.com:OpenMindClub/[图书名].git
    fetch = +refs/heads/*:refs/remotes/origin/*

再进行默认推送, 就发现,自动完成了两个仓库的分别 push:

$ git pu
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 2.00 KiB | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To https://[用户名]:[口令]@git.gitbook.com/[帐号]/[图书名].git
   f27428a..0d06615  master -> master
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 2.00 KiB | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To git@github.com:OpenMindClub/[图书名].git
   f27428a..0d06615  master -> master

( ̄▽ ̄)

综上可得:

Acural commented 8 years ago

gitbook 双推技巧页面404 无法打开。 我对gitbook github双推的理解:在电脑本地对文章进行编辑后,通过双推直接推送到gitbook页面与github上。 自己对双推设置还没折腾好,尝试利用同期学院提供的优秀代码 将clone到本地的个人repo(与gitbook关联的)中README文件修改,执行脚本后,gitbook github均无变化( ⊙ o ⊙ ) 明天排查原因并反馈到Issue上