LoginSignup
0
1

More than 3 years have passed since last update.

WindowsのPCからコマンドでgithubと連携

Last updated at Posted at 2021-02-14

githubのデスクトップアプリ(mac)ばかり使っていて
gitについてまったく理解していなかったので、自分のメモとして投稿します。

ターミナル上にて

まずはターミナル上で、githubとリモート連携したいフォルダへ移動します。
コマンドはここでは解説しないので、ターミナル(コマンド)の記事を参照ください。

gitの初期設定をする

$ git init
$ git add .
$ git commit -m 'xxx'

git initでgitファイルを追加し、git add .git commit -m 'xxx'してpush手前までもっていきます。

github上で受け入れ準備

20210214-01.jpg

「New repository」でリポジトリ追加画面へ移動。

20210214-02.jpg

1.「Repository name」を入力。(レギュレーションはgithubに従う。緑チェックがでれば使用可能)
2.公開ステータスを設定。「Public」「Private」の2種類から選べます。「Public」にすると全世界に公開されてしまいます。危険性については下記の記事が有名ですね。(遠い目)
【SMBC漏洩 騒動まとめ】三井住友銀行のソースコードを年収300万の艦これユーザーが無断で公開
3.「Create repository」でリポジトリを作成

githubへの受け入れ準備はこれでOK

またまたターミナルで操作

$ git remote add origin https://github.com/kaorioka/hogehoge.git

1.リモートリポジトリを追加するコマンドを入力。
https://github.com/~の部分を今回連携するリポジトリのものにする。
URLはgithubで「Create repository」押下後に表示される画面にでてくるものを使用。
下記の画像のHTTPSのURLをコピー!

20210214-03.jpg

2.プッシュ!

$ git push origin master

上記のコマンドでgithubのリモートリポジトリにプッシュできていれば完了です。

0
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
0
1