Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij IDEA how to upload project to remote branch with git plugin?

I have Intellij IDEA 12.0.1 I am using build-in Git plugin. I am able to create local repository. Now I want to upload my source code to remote repository. Can I do this with Intellij IDEA plugin?

Thank you.

like image 988
Dmytro Danylyk Avatar asked Dec 27 '12 08:12

Dmytro Danylyk


People also ask

How do I push a project from IntelliJ to GitLab?

After you've committed some changes, you'll probably want to push them from your local repository to GitLab. This functionality is again hidden in IntelliJ's menus: Click "VCS" > "Git" > "Push..." The window that opens will show a preview of all local commits that you will push to, the remote repository.


3 Answers

You can't upload your local Git repository to remote using IntelliJ IDEA plugin. For this you need to use Git Bash or Git client, for example Source Tree.

To create local Git repository with IntelliJ IDEA plugin

  1. In IntelliJ IDEA menu VCS -> Import into Version Control -> Create Git Repository
  2. In pop up window select your project and click ok.
  3. Commit all necessary files to you local branch master

To upload local repository to remote using Git Bash

  1. Open Git Bash and navigate to your project folder e.g cd 'D:\projects\TestProject'
  2. In Git Bash git remote add origin http//IP/path/to/repository
  3. In Git Bash git push origin master
  4. In IntelliJ IDEA right-click on project select Synchronize 'TestProject'
  5. In IntelliJ IDEA right-click on project select Git -> Repository -> Branches -> origin/master -> Checkout as new local branch

To upload local repository to remote using Source Tree

  1. In Source Tree File -> Open and navigate to your project folder e.g cd 'D:\projects\TestProject'
  2. In Source Tree Repository -> Add Remote, you should see Repository Settings window enter image description here
  3. Click Add button, and fill Remote details enter image description here
  4. Finally click Ok button Now you should be able to do pull/push using IntelliJ IDEA plugin.
  5. In IntelliJ IDEA right-click on project select Synchronize 'TestProject'
  6. In IntelliJ IDEA right-click on project select Git -> Repository -> Branches -> origin/master -> Checkout as new local branch

Now you should be able to do pull/push using IntelliJ IDEA plugin.

like image 104
Dmytro Danylyk Avatar answered Sep 23 '22 12:09

Dmytro Danylyk


It is possible in Intellij IDEA.
You should add a remote repository for your local repository in git bash by below command.

git remote add origin YOUR_REMOTE_REPOSITORY_ADDRESS. for example git remote add origin https://gitlab.com/my_account/my_repository.git 

In Intellij IDEA when you want to commit any change to repository use ctrl + k and it will show you a window like below image. In this window you can choose commit and push so it will commits and push change to local and remote repository.
enter image description here Also if you want to only push to remote repository use ctrl + shift + k to pushing changes.
I hope this answer helps you.

like image 28
taher Avatar answered Sep 23 '22 12:09

taher


I had the same problem and I believe this is still the case with IDEA 12 unless I'm mistaken:

An alternative to using the command line would be SourceTree (available for Mac & Win) to manage remotes or manage Git/Hg repositories completely. It is a free GUI client from Atlassian (no affiliation disclosure).

You can download it here.

like image 22
Karthic Raghupathi Avatar answered Sep 21 '22 12:09

Karthic Raghupathi