0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Git hub設定と連携

0
Last updated at Posted at 2026-02-05

はじめに

今回は学習用 兼 記録用として、Githubの連携を行いました。
基本的なことですが、記録用として投稿します。

GitHub 設定と連携

1. 新しいリポジトリを作成

  1. GitHub → New repository
  2. リポジトリ名を入力(例:b_api
  3. README・.gitignore・LICENSE は作らない(空のリポジトリにする)
  4. Create Repository

2. ローカル側でGit初期化

git init

このコマンドにより、現在の作業ディレクトリ内に新しい 「.gitディレクトリ」が作成される。
これにより、「git branch」や「git add」や「git commit」などのコマンドが使用できるようになる。

git branch -M main

git initで作成されたブランチ名を強制的にmainにするコマンド。Gitのバージョンによって、作成されるブランチ名がmainだったりmasterだったりするため、"main"に統一。

3. Githubリモートを追加

  1. 作成したGithubのリポジトリから、クローンURLをコピー
    スクリーンショット 2026-02-05 16.02.00.png
  2. ローカル上でクローンを実施
git remote add origin https://github.com/ユーザー名/リポジトリ名.git

4. リモートにpush

git add .
git commit -m"Initial commit"
git push -u origin main
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?