Adding a remote git repo through intelliJ

39,153

Solution 1

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

Solution 2

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).

Solution 3

This isn't possible in PyCharm (for now), but if you'd like to use a GUI tool instead of the console, I would recommend SourceTree (free to use).

Once set up in SourceTree (Repository -> Add Remote), it will be visible and usable in PyCharm as well.

Share:
39,153

Related videos on Youtube

Games Brainiac
Author by

Games Brainiac

The real challenges that we face are social. Should you ever feel grateful because of one of my answers, you need do nothing more than say thanks. I don't do what I do so that I can get more wish-list items, or get you to hire me for mentoring. I do it because I like helping people when I have the time.

Updated on October 19, 2020

Comments

  • Games Brainiac
    Games Brainiac over 3 years

    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?

  • Timo
    Timo almost 10 years
    Time passes but the IntelliJ Team it seems does not work on the issue of creating a remote git account from the programme.
  • PeterS
    PeterS almost 8 years
    Not sure how a tool that requires me to log into atlassian is helping to add files to my local git.
  • Ian G
    Ian G almost 8 years
    for those of you that are special like me :) make sure (at least in Windows) to change directory to the root of your IntelliJ project where the ".git" folder is then run these commands.
  • mlissner
    mlissner almost 8 years
    Good news. This is landing in the next version of Intellij! Check the link above.
  • alexander remus
    alexander remus about 3 years
    Is there something I'm missing? Cannot find it in IDEA 2021... I see 'VCS' in the menu bar, but from there I cannot find 'Git'
  • CrazyCoder
    CrazyCoder about 3 years
    @alexanderremus VCS | Create Git Repository first.