LoginSignup
9
12

More than 5 years have passed since last update.

IntelliJ IDEA でプロジェクト作成し、Bitbucketにpushするまで

Last updated at Posted at 2016-07-31

新規プロジェクトを作成して、Bitbucketで管理できるようにするまでを簡単にメモ

前提

  • IntelliJ IDEA : 2016.2
  • Bitbucket のアカウントは作成済み

新規プロジェクトの作成

「Create New Project」(またはメニューの[File]-[New]-[Project])を選択するして、「New Project」ウィンドウを表示する。

IntelliJ_IDEA_1.png

IntelliJ_IDEA_2.png

Project SDKでjava1.8を選択し、GradleでJavaを選択して、[Next]を押す。

次は以下を入力して、[Next]を押す。

項目 メモ
GroupId com.example プロジェクトのルートパッケージ名
ArtifactId sample プロジェクト

IntelliJ_IDEA_3.png

下記をチェックする。
Create directories for empty content root automatically
Create separate module per soruce set

Gradleは「Use default gradle wrapper」を選択し、GradleJVMはProject SDKと同じにする。

IntelliJ_IDEA_4.png

内容を確認して、[Finish]を押す。

IntelliJ_IDEA_5.png

moduleのディレクトリなどを作成するため、しばらく待つ。
テンプレートのディレクトリの初期作成が終わると下の画面のような構成になる。

IntelliJ_IDEA_6.png

.gitignoreファイルを作成する

.idea
*.iml
.gradle
build

bitbucket にリポジトリを作成

ブラウザより、bitbucketに新しいリポジトリを作成する。
例では、intellij_sample で作成

IntelliJ_IDEA_7.png

プロジェクトの内容をリポジトリにpush

プロジェクトのメニューからVCS - Import into Version Control - Create Git Repository... を選択して、「Select directory for git init」ウィンドウを表示する。

プロジェクトのディレクトリを選択して、[OK]を押す。

IntelliJ_IDEA_8.png

プロジェクトのGit - Addを選択して、プロジェクトの内容を追加する。

IntelliJ_IDEA_9.png

次に、Git - Commit Directory... を選択して、「Commit Changes」ウインドウを表示する。

Commit Message を入力して、Commit

IntelliJ_IDEA_10.png

Git - Repository - Push を選択して、「Push Commits」ウィンドウを表示する。

Define remote を選択して URLに bitbucket の URL を入力する。

URLはリポジトリの「既にプロジェクトがあります」の git remote add origin xxxx の内容を参照。

git@bitbucket.org:username/intellij_sample.git

IntelliJ_IDEA_11.png

そして、Pushを押す。
Bitbucketでソースがpushされたことを確認。

IntelliJ_IDEA_12.png

9
12
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
9
12