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?

【初心者向け】React + TypeScript + Tailwind CSS プロジェクトを GitHub & Vercel に公開する手順

Posted at

1. プロジェクトの準備

すでに以下の環境が整っている前提です:

  • React + TypeScript プロジェクト(例: create-react-app または Next.js
  • Tailwind CSS の導入済み
  • VSCode を使用

2. Git 初期設定(1回だけ)

git config --global user.name "あなたの名前"
git config --global user.email "あなたのメールアドレス"

3. Git 初期化と初回コミット

cd プロジェクトのフォルダ
git init
git add .
git commit -m "chore: initial commit"

4. GitHub リポジトリと接続

GitHub で新しいリポジトリを作成し、以下のように接続:
git remote add origin https://github.com/ユーザー名/リポジトリ名.git
すでに origin が存在する場合は:
git remote set-url origin https://github.com/ユーザー名/リポジトリ名.git

5. GitHub へ初回プッシュ

git push -u origin main

エラー対応まとめ

403 permission denied
gh auth login
rejected (non-fast-forward)
git pull origin main --allow-unrelated-histories

6. マージコンフリクト解決方法

1.対象のファイルを開く(例: .gitignore
2.以下のような記号をすべて削除:
<<<<<<< HEAD
(ローカルの内容)
=======
(リモートの内容)
>>>>>>> origin/main
3.残したい内容に整理して保存
4.解決後、以下を実行:
git add .
git commit -m "fix: resolve merge conflict"
git push -u origin main

7. Vercel にデプロイ

1.https://vercel.com にアクセスし GitHub アカウントでログイン
2.「New Project」→ GitHub から対象リポジトリを選択
3.自動設定のままでデプロイ(Next.jsならそのままでOK)
4.公開URLが発行され、サイトが表示される

よく使うコミットメッセージ例

git commit -m "chore: initial commit"
git commit -m "fix: resolve merge conflict"

フォルダ構成の注意点

  • pages/ や components/ フォルダを作成して整理(Next.js)
  • 不要なファイルは削除OK(例: README.old.mdなど)
  • ! マークが付いたファイルはコンフリクトしている可能性あり

まとめ

ステップ 内容
1 Git 初期設定
2 Git 初期化とコミット
3 GitHub リポジトリ作成と接続
4 GitHub へプッシュ
5 マージコンフリクト解決
6 Vercel へデプロイ
7 Webサイト公開完了!
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?