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?

【Windows11】Github 環境構築

0
Posted at

1. GitHub アカウントを作成

ブラウザで https://github.com/signup を開いて、案内に沿ってアカウントを作成する。

  • メールアドレス
  • パスワード
  • ユーザー名(半角英数字。作品を公開する時に URL に入るので、無難な名前がおすすめ)

登録したメールアドレスに届く確認メールのリンクを踏めば完了。

2. GitHub CLI をインストール

PowerShell を開いて、以下のコマンドを実行する。

winget install --id=GitHub.cli -e

インストールが終わったら、PowerShell を一度閉じて開き直す

動作確認。

gh --version

gh version 2.x.x のように表示されれば OK。

3. GitHub にログイン

以下のコマンドを実行。

gh auth login

いくつか質問されるので、以下のように答える(矢印キーで選択、Enter で決定)。

  • Where do you use GitHub?GitHub.com
  • What is your preferred protocol for Git operations?HTTPS
  • Authenticate Git with your GitHub credentials?Yes
  • How would you like to authenticate GitHub CLI?Login with a web browser

すると画面に 8桁のコード(例: A1B2-C3D4)が表示され、Enter を押すとブラウザが開く。表示されたコードを入力して、画面の案内に沿って認可する。

ターミナルに戻って ✓ Logged in as ユーザー名 と表示されれば OK。

4. 動作確認(push まで)

GitHub 上に練習用リポジトリを作って push できるか確認する。

適当な場所に作業用フォルダを作成。

cd Desktop
mkdir github-test
cd github-test
git init
"hello" | Out-File hello.txt
git add hello.txt
git commit -m "first commit"

GitHub 上にリポジトリを作成して、そのまま push まで一気にやる。

gh repo create github-test --public --source=. --push

https://github.com/ユーザー名/github-test が表示されるので、ブラウザで開いて hello.txt が上がっていれば OK。

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?