LoginSignup
1
3

More than 3 years have passed since last update.

GitHubのアカウント登録から初めてのプッシュまで試してみる

Last updated at Posted at 2019-10-18

GitHubへのアカウント登録から初めてソースをアップするまでの流れです。

GitHubへアカウント登録します

以下のサイトの「GitHubへ登録する」ボタンからアカウント登録します。

リポジトリを作成します

GitHubへログインして、画面左側のRepositoriesの「New」ボタンからリポジトリを作成します。

  • Repository name:リポジトリの名前を指定します。
  • Description (optional):リポジトリの説明を指定します。任意です。
  • Public or Private:外部へ公開するか、公開しないかです。

リポジトリを追加する時にこのリポジトリのURLを指定するのでメモしておきます。
Repositoriesからこのリポジトリを追加した時に表示されるURLがそれです。

gitをインストールします

今回はUbuntuで開発してるのでUbuntuでの操作となります。

# gitをインストールします
$ sudo apt-get update
$ sudo apt-get install git

# インストールの確認のためにバージョンを表示します
$ git --version
git version 2.17.1

gitの設定をおこないます

# ユーザーの名前を指定します
$ git config --global user.name [name]
# ユーザーのメールアドレスを指定します
$ git config --global user.mail [mail]

# 設定を確認します
$ git config --global --list
user.name=[name]
user.mail=[mail]

gitの初期化から、ソースのコミットまで

GitHubにあげたいソースはmyprojectにあるものとします。

# プッシュしたいソースのあるフォルダに移動
$ cd myproject
# gitの初期化
$ git init
# ソースをバージョン管理に追加
$ git add .
# ソースのコミット
$ git commit -m "first commit"

リポジトリの追加からプッシュまで

# リポジトリを追加
$ git remote add origin <URL>
# リポジトリの確認
$ git remote -v
origin  https://github.com/~ (fetch)
origin  https://github.com/~ (push)

# プッシュ
$ git push origin master

リポジトリの確認

GitHubのリポジトリを確認してソースが登録されていれば成功です。

以上です。

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