LoginSignup
21
17

More than 5 years have passed since last update.

XCode から gitHub のリポジトリを作成する

Last updated at Posted at 2018-03-28

入門書を見ながら Swift アプリを作成している。せっかくなので gitHub にアップしようとしたら、やり方がわからず、試行錯誤した。

概要

  1. アプリを作成(git 管理対象外)
  2. git (ローカルリポジトリ)の管理対象にする
  3. gitignore を作成する
  4. gitHub リポジトリを作成し、push する

手順

1. アプリを作成

helloSwift という名前のアプリ。詳細は略。

Kobito.767kq2.png

リポジトリ管理対象外であります。
Kobito.kDYn0q.png

フォルダも見ておく

$ ls -la
total 0
drwxr-xr-x@ 4 hoge  staff  128  3 28 21:05 .
drwxr-xr-x@ 7 hoge  staff  224  3 28 21:05 ..
drwxr-xr-x@ 7 hoge  staff  224  3 28 21:05 helloSwift
drwxr-xr-x@ 5 hoge  staff  160  3 28 21:05 helloSwift.xcodeproj

2. git (ローカルリポジトリ)の管理対象にする

「Source Control」-「Create Git Repositories...」
Kobito.XmW6Fn.png

git リポジトリを create する
Kobito.N9RmcE.png

ローカルリポジトリに master ブランチが作成されている
Kobito.cRe6Tj.png

.git フォルダができている

$ ls -la
total 0
drwxr-xr-x@  5 hoge  staff  160  3 28 21:12 .
drwxr-xr-x@  7 hoge  staff  224  3 28 21:05 ..
drwxr-xr-x@ 12 hoge  staff  384  3 28 21:12 .git
drwxr-xr-x@  7 hoge  staff  224  3 28 21:05 helloSwift
drwxr-xr-x@  5 hoge  staff  160  3 28 21:05 helloSwift.xcodeproj

3. gitignore を作成する

プロジェクト直下に .gitignore を作成する

$ vi .gitignore

内容はgithub/gitignoreのを利用した。

4. gitHub リポジトリを作成して push する

gitHub のアカウントを登録する。

メモしなかったけど、こんな感じで登録できるっぽい。

gitHub のリポジトリを作成する

XCode の SourceCodeNavigator より、gitHub のリポジトリを作成する

Kobito.Qhot3m.png

リポジトリ名とか指定する
Kobito.u9aSqw.png

gitHub で確認!
Kobito.ZXUMOt.png

21
17
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
21
17