Visual StudioからGitHubを利用する
既にVisual StudioからGitHubを使っているので、最初の一歩は少し怪しいかも。だから、関係ありそうなところは全部載せておこう。
前準備
visual Studio InstallerからGitHubのパッケージを導入しておく
今回はVisual Studio 2019にGitHubを使うことを想定する。
変更をクリック
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
個別のコンポーネントを選択し、検索欄にgitと入力。
Git for Windowsと
GitHub Extension for Visual Studio
にチェックを入れてインストールする。
私の環境ではすでに入ってしまっているので、
ちょっと画面イメージが違うかもしれませんが。。
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
Visaul Studioのオプションのプラグイン管理、プラグインの選択でGitを選択しておく
ツール→オプションを開く
検索オプションでプラグインと入力するか、
直接ソース管理のプラグインの選択をクリックする。
現在のソース管理プラグインでGitを選択する。
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
Visual StudioからGitHubに接続する
チームエクスプローラを開く
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
チームエクスプローラの接続の管理を押して
Connect to GitHubをクリックする
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
GitHubのアカウントを入力して接続する
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
これでVisual StudioからGitHubに接続できたはず。
Visual StudioからGitHubのリポジトリ操作
リポジトリ作成
昨日のエントリで実験的にBlazorプロジェクトを作ったので
それをGitHubリポジトリに加える。
まずは、ソリューションを開く。
ファイル→ソース管理に追加
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
※なんか画面が変わったような気がするので、以下の手順と同じことを最新の環境でやった記事を書きました。
その他のウィンドウからGitHubを開く
はじめにボタンを押す
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
チームエクスプローラで同期メニューが開かれた状態となっているので
説明(コミットメッセージになる)を記述して公開ボタンを押す
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
作成が完了。
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
Git Hubでも確認
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
ソース変更をGitHubに反映
チームエクスプローラでHomeボタンを押してメニュー画面にする
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
メニューの中に変更というのがあるので、それをクリック
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
前回作ったBlazorプロジェクトの中身を少し変更する。
NewPage.razorに以下の一行追加する。
<h3>>fujiko</h3>
すると、チームエクスプローラ上で変更対象が表示される。
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
右クリックしてみ変更のものと比較すると
新たに追加したところが表示される。
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
右クリックのメニューでこれ以外にも、ステージにあげて限定的にコミットしたりできるので、いろいろいじくるのをお勧めします。
この変更で問題ないなと思ったら、変更をコミットする。
コミットだけでなく、一発でプッシュ,同期ができる。
すべてをコミットの▽を押すと、いくつかのメニューがでるので、任意の一つを選ぶ。
今回はすべてをコミットして同期をした。
これは、コミットしてプッシュしてGitHubに同期するというもの。
![](http://takumi-oda.com/blog/wp-content/themes/luxeritas/images/trans.png)
ディスカッション
コメント一覧
まだ、コメントがありません