GitHub連携の設定方法 / GitHub Setup Guide
お酒記録では、GitHub を使って記録を仲間と共同編集したり、Webページとして公開したりできます。この機能は任意です。使わなくても、記録・写真・バーコード・マップなどアプリの全機能はご利用いただけます。
In Osake, you can use GitHub to co-edit your records with friends and publish them as a web page. This feature is optional. All core features (recording, photos, barcode, maps, etc.) work without it.
GitHub is a free service for managing code and files. Below are the minimum steps to use it as a sync destination for Osake.
手順1: GitHubアカウントを作る / Create a GitHub account
- github.com/join にアクセスし、無料アカウントを作成します。
- 登録したユーザー名(アカウント名)を控えておきます。あとでアプリに入力します。
Go to github.com/join and create a free account. Note your username; you will enter it in the app later.
手順2: リポジトリ(保存先)を作る / Create a repository
- GitHub の画面右上の「+」→「New repository」を選びます。
- Repository name に好きな名前(例:
osake-data)を入力します。 - 「Add a README file」にチェックを入れます(初期化が必要です)。
- 公開範囲は Public(だれでも閲覧可)または Private(自分と招待した人のみ)を選びます。Webで公開したい場合は Public にします。
- 「Create repository」を押します。
Click "+" at the top right, then "New repository". Enter a name (e.g. osake-data), check "Add a README file", choose Public or Private, and click "Create repository".
手順3: アクセストークンを発行する / Create an access token
アプリが GitHub へ記録を読み書きするために、パーソナルアクセストークン(Classic)が必要です。
- GitHub 右上のアイコン →「Settings」を開きます。
- 左メニューの一番下「Developer settings」を選びます。
- 「Personal access tokens」→「Tokens (classic)」を選びます。
- 「Generate new token」→「Generate new token (classic)」を選びます。
- Note に用途(例:
Osake)を入力、Expiration(有効期限)を選びます。 - スコープは「repo」にチェックを入れます(リポジトリの読み書きに必要)。
- 「Generate token」を押し、表示されたトークン文字列をコピーします。
The token is shown only once. Copy it somewhere safe and keep it private.
Open Settings > Developer settings > Personal access tokens > Tokens (classic) > Generate new token (classic). Set a note and expiration, check the "repo" scope, generate, and copy the token.
手順4: アプリに登録する / Enter details in the app
- お酒記録の メニュー →「設定」→「GitHub連携」を開きます。
- アカウント名(GitHubのユーザー名)、トークン(手順3でコピーした文字列)、リポジトリ名(手順2で付けた名前)を入力します。
- フォルダは、Pages を使う場合の公開元に合わせて選びます(通常は
/(root))。 - 「接続テスト」を押して、成功と表示されれば設定完了です。
In the app, open Menu > Settings > GitHub. Enter your account name, token, and repository name, choose the folder, then tap "Test connection".
手順5: 同期する / Sync
- メニューの「Webサイトと同期」を押すと、記録が GitHub にアップロードされ、別の端末の記録とも統合されます。
- この時点ではデータが GitHub に保存されるだけです。Webページとして公開するには、次の手順6で GitHub Pages を有効にします。
Tap "Sync with Website" to upload and merge records. At this point the data is only stored in GitHub. To publish it as a web page, enable GitHub Pages in step 6.
手順6: GitHub Pages を有効にして公開する / Enable GitHub Pages
GitHub Pages を有効にすると、記録を誰でも見られる Web ページとして公開できます。この設定は最初に一度だけ行えば、以降は同期するだけで内容が更新されます。
- 公開したいリポジトリを開き、上部の「Settings」タブを選びます。
- 左メニューの「Pages」を選びます。
- 「Build and deployment」の Source で 「Deploy from a branch」 を選びます。
- Branch で 「main」 を選びます。
- フォルダは次のどちらかを選びます(アプリの設定と必ず合わせます):
/ (root)… アプリの「フォルダ」設定を/(root)にした場合(おすすめ)/docs… アプリの「フォルダ」設定を/docsにした場合
- 「Save」を押します。数十秒〜数分後、ページが公開されます。
Important: The folder you pick in GitHub Pages (root or docs) must match the "Folder" setting in the app. If they differ, the page will not appear.
Open the repository > Settings > Pages. Under "Build and deployment", set Source to "Deploy from a branch", Branch to "main", and choose the folder — "/ (root)" or "/docs" — to match the app's Folder setting. Click Save. The page goes live in a few minutes.
公開ページを開く / Open the published page
公開後は、メニューの「Webサイトへ」でページを開けます。URL は https://<ユーザー名>.github.io/<リポジトリ名>/ の形になります。
After publishing, use "Open Website" in the menu. The URL looks like https://<username>.github.io/<repository>/.
仲間と共同編集するには / Co-editing with friends
同じリポジトリを仲間と共有すると、それぞれの端末で登録・修正した内容を同期して最新にまとめられます。Private リポジトリの場合は、GitHub のリポジトリ設定で仲間を Collaborator として招待してください。
Share the same repository with friends to merge entries from each device. For a Private repository, invite them as Collaborators in the repository settings.