Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a remote git repo through intelliJ

I want to know how to add a remote git repo via intelliJ, not through the git bash. Now, from what I've seen in this tutorial, it can be done, but whenever I try to push, the dialogue never comes up. If you push to the very bottom, you can see that it can be done in probably a previous version of IntelliJ. How can you do it with version 12 or rather PyCharm 2.6?

like image 486
Games Brainiac Avatar asked Jun 12 '13 14:06

Games Brainiac


People also ask

How do I import a repository into IntelliJ?

Launch IntelliJ IDEA. If the Welcome screen opens, press Ctrl+Shift+A , type project from existing sources , and click the Import project from existing sources action in the popup. Otherwise, from the main menu, select File | New | Project from Existing Sources.

How do I add a remote repository in Git?

To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at. The git remote add command takes two arguments: A unique remote name, for example, “my_awesome_new_remote_repo” A remote URL, which you can find on the Source sub-tab of your Git repo.


2 Answers

UPDATE: this feature is available since 2016.3 version.

VCS | Git | Remotes | Add (Alt+Insert).

git remotes


Original answer:

You can choose from the existing remotes, but you can't add new remotes from the UI, there is a feature request:

  • IDEA-87099 Provide ability to add remote repositories to local git repository

The workaround, for those new to Git is to use the commandline and add a remote like so:

git remote add remoteName remoteUrl 

After that, the remote will show up in the pull dialog in Intellij, but it won't show any branches until you do a fetch, like so:

git fetch remoteName 
like image 86
CrazyCoder Avatar answered Sep 21 '22 07:09

CrazyCoder


If you want a menu entry, I think for now the easiest workaround is to create an "external tool" menu entry (Preferences -> Tools -> External Tools -> Add) in IntelliJ or Pycharm. I've created one that calls '/usr/bin/git' with 'remote add origin $Prompt$' (which opens a prompt window asking for the remote git URL) and the current dir field left blank. This works great for my workflow (create local git repository, later push it to a new remote one).

like image 28
Chris Avatar answered Sep 23 '22 07:09

Chris