Set Default Remote GIT per project?

Hey there,

I was just curious if there is a way to set a default remote git.  I have to copy/paste the remote git path in every time I want to push the changes.  Am I just doming something wrong?

Thanks!
-David

0
7 comments

Hi David,

Make sure that you have remote properly configured.
Open file <repository_root>/.git/config
It should look something like this:

[core]

  repositoryformatversion = 0  

  filemode = true  

  bare = false  

  logallrefupdates = true  

  ignorecase = true

[branch "master"]  

  remote = origin   

  merge = refs/heads/master

[remote "origin"]  

  url = git@github.com:user/repo.git  

  fetch = +refs/heads/*:refs/remotes/origin/*

Important thing here is the configuration of the "master" branch which is associated with remote "origin", and the configuration of "remote" itself.
Note that if you're using IDEA 10, there is also "Push Active Branches" dialog which may be more user-friendly than "Push Changes". However the master branch still have to be configured.

If you still have difficulties, could you please provide your .git/config here.

1
Avatar
Permanently deleted user

Kirill,

Thank you for your reply.  I'm pretty new to GIT (obviously) it's good to know that I can add the remote host through the config file.  Here are the steps I took to get GIT working with PhpStorm.

Version Control > Git Init

Version Control > Git > Current Branch

This sets it up so I can use GIT as expected but I couldn't find any way to set the default remote git through the GUI.  Here is my config from following the above steps.

[core]      repositoryformatversion = 0      filemode = false      bare = false      logallrefupdates = true      symlinks = false      ignorecase = true      hideDotFiles = dotGitOnly [branch "master"]      remote = .      merge = refs/heads/master



So it looks like I should be able to just put the remote git in the config, my questions was more just asking if it's possible to do it through the GUI interface.

Thanks!
0

David,

Currently there is no way to define a remote via IDEA GUI.
So you have either to edit .git/config by hands, or use special git commands (git-config, git-remote) to do this.

Usually you don't need this, because when you clone (checkout) a repository, git automatically creates a remote configuration, so that your "parent" repository (where you're going to push and pull) is the repository you've cloned from.

Could you please clarify: what actually you want to do? For example, share your repository on GitHub or something else?
I'll try to guide you with exact steps to setup your git then.

0
Avatar
Permanently deleted user

I'm working from the prospective of starting a brand new project that I want to share on Github.  

There would be no project for me to checkout for starters so it would make more sense if there was a remote version control setting in the IDEA GUI (like setting your project FTP) where you can up your default Repository.  Does that make sense?

I understand now that I can set the default remote repository in the config file, but it still feels odd to me that it would be part of the project GUI! :)

Thanks for the help and replies.

0

You definitely are right.
Actually our team is working now for a plugin for integration with GitHub, but configuring remotes in general also will be implemented. I've created a YouTrack request for it: http://youtrack.jetbrains.net/issue/IDEA-60389

0
Avatar
Permanently deleted user

Hello David,

We are working on seamless integration with github, you can have a look at the roadmap here: http://confluence.jetbrains.net/display/IDEA/GitHub+Integration+Stories
This functionality will be available in coming EAP build.

Regards,
Oleg

0
Avatar
Permanently deleted user

Awesome!  Thanks guys :)

0

Please sign in to leave a comment.