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 push

0
Last updated at Posted at 2026-09-03

プッシュするディレクトリを作る。

mkdir REPOSITORY_NAME           # ディレクトリ REPOSITORY_NAME を作る。
cd REPOSITORY_NAME              # ディレクトリ REPOSITORY_NAME に移動する。
echo "# Read Me" > README.md    # 文字列 "# Read Me" をファイル README.md に書き込む。

ファイルを1つ作る必要があるので README.md を作っておく。

Github にリポジトリを作る。

Github にリモートリポジトリを新規作成する。
image.png

リモートリポジトリの URL をコピーしておく

リポジトリを作成した際に表示される画面の中から URL をコピーしておく。
image.png

ローカルリポジトリを作成し、リモートリポジトリと接続する

git init                          # ローカルリポジトリを初期化する。
git add *                         # ローカルリポジトリにすべてのファイル (*) を追加する。
git commit -m "initial commit"    # ローカルリポジトリにメッセージ "initial commit" を添えてコミットする。
git branch -m master main         # ローカルリポジトリのブランチ名を master から main に改名する。
git remote add origin git@github.com:USER_NAME/REPOSITORY_NAME.git    # リモートリポジトリの origin として URL git@github.com:USER_NAME/REPOSITORY_NAME.git を加える。
git push -u origin main           # リモート origin にブランチ main をプッシュする

git init でローカルリポジトリを作るとブランチ名が master になってしまうので 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?