1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitHubにローカルのプロジェクトをリポジトリとして追加・公開する手順

Last updated at Posted at 2025-05-14

✅ 事前準備

1. GitHubで新しいリポジトリを作成する

  1. 上記リンク先の GitHub アカウントにログイン
  2. 右上の「+」→「New repository(新しいリポジトリ)」をクリック
  3. 以下を入力・選択
    • Repository name:例)my-sns-app
    • Description(任意)
    • Public / Private(好みに応じて)
    • 他のチェックは外してOK(READMEや.gitignoreはローカルで作成できます)
  4. 「Create repository」をクリック

✅ ターミナルでの作業(Mac)

2. ターミナルを開いて、プロジェクトディレクトリへ移動

cd ~/path/to/your/project

3. Git初期化 & コミット

git init
git add .
git commit -m "Initial commit"

4. GitHubのリモートリポジトリと接続

git remote add origin https://github.com/TK-19881224/リポジトリ名.git

5. GitHub で Personal Access Token を発行

1.	GitHub にログイン
2.	右上のプロフィール → Settings
3.	左メニューから Developer settings → Personal access tokens → Tokens (classic)
4.	Generate new token をクリック
•	有効期限(例: 90 日)
•	権限: repo にチェック
5.	生成されたトークンをコピー(1度しか表示されません!)

6. macOSのGitに認証情報を登録

ターミナルで次を実行👇

git config --global credential.helper store

これで、一度入力した認証情報を保存できるようになります。

7. リモートにプッシュ(初回はmainブランチを明示)

git branch -M main
git push -u origin main

8. 入力内容

•	Username → https://github.com/以降のパス(例: https://github.com/TK-19881224 → TK-19881224)
•	Password → 発行した Personal Access Token を入力

✅ 完了!

これでGitHub上にあなたのプロジェクトがアップロードされます。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?