Need a way to update two gitlab repositories through single intellij project window - intellij-idea

I am working on a project which is hosted on a particular gitlab repository. Often we dont get to connect to this repository because of network issues. Hence I have created my own local gitlab repository.
Now to keep the both repositories updated, i have to copy paste the code from one folder linked to one repository to other folder which is linked to other repository.
Is there a way in intellij wherein i can work in the same window but when committing and pushing the changes, both the repositories get updated at the same time ?
Regards,
Thanks in advance

Personally, I think it is far, far easier to use Git from the terminal/powershell.
If you are interested in using the terminal, or powershell, with Git, and want set multiple remote origins, then there is a already a detailed answer about pushing and pulling from multiple remote locations.
Otherwise, look at Intellij's VCS menu, then select "Git."
Then select "remotes":
Then get add your other Git remotes by clicking "+" and add:
Add you should be set. Just select which remote you would like to push to.

Related

Rename a repo in GitKraken?

I have been unable to find how to rename a local repo in GitKraken, or if this feature is unavailable.
I believe the option was available if you use the Init feature to generate the local and remote repos, but I'm wanting to update the repo name after it's already been set up and used.
(I set up my remote repo on BitBucket, then cloned my local repo in GitKraken, and it just uses the last folder name in the local path as the repo name.)
My recommendation would be to push everything you have to repo, then rename on the repository itself online, then re-clone from the new location as if it was a new repo.
This is the top result when searching for solutions to this issue.
In case anyone stumbles across this post, these days GitKraken has the ability (at least it does on macOS) to add aliases to existing repos which resolves this issue for me.
To add an alias, you first need to open the repo, then right-click the tab (in the tab bar at the top), and choose the "Alias repository" option. This will then allow you to define an alternative name for that particular repo.
A screenshot showing the open, tab context menu.
Happy aliasing! :)

Analogue of fetch for Mercurial? How to see a new branch from IntelliJ?

If a branch is created in the repository (Git or Mercurial), I still don't see it in the IntelliJIdea. If the CVS is Git, I have to issue fetch command for to see a new branches.
But for Mercurial I don't see neither fetch, nor something similar. How can I make that new branch visible for IntelliJ?
As I understand, you mean a branch created on a remote server.
It is not IntelliJ specific, you need to get information into your local repository first (this is what you actually do calling pull in Tortoise)
But you don't need to use Tortoise, you can pull from IDEA using VCS - Mercurial - Pull

In gitlab, is it possible to create two or more repositories into only one project?

I'm running GitLab in a container of Docker but it's okay so far, no problem with that at all. I'm just in doubt about the creation of repositories in projects. I've created my first project in GitLab then after it creation i'd been redirected to a page with some commands to use in terminal. There were three sections, one of them were "Create a repository", i've used those commands and so i could create my repository of my project. However, after this, that page with commands went out and i could just see it again when i created a new project. After all,here goes my question again, is it possible to create two or more repositories into only one project?
I only have time to give a short answer right now, but I hope it helps:
In short: NO
But also: YES, after a fashion
There is a one-to-one correspondence between repositories and projects (which would perhaps better be called repositories as well).
One Solution: Gitlab supports the creation of groups of projects/repos, which can be managed as a project consisting of multiple repos.
Git-based/local Options
If you are interested in git-based solutions to including a repository inside of another repository check out my answer here. If you use either the subtree merge method (at least a variant of it that tracks history) or subrepository method in this answer, your subprojects will appear in your master project in Gitlab, but the master project will also track changes in the subprojects.
Alternative Solution: Create a dummy repo that contains all of your desired repos as subrepos. This master repo will then track all subrepo changes. However; there are a few logistical issues, the .git files for the subrepos will not exist on Gitlab, so you might want a dedicated client with these files to pull the master repo from Gitlab (probably one commit at a time, if you want the subrepo histories to match the main repo history) and update the corresponding local subrepos (these could also be stored independently on GitLab).

user specific maven settings in repository

http://maven.apache.org/settings.html As per documentation the user specific settings can be either copied to the .m2 folder or under the maven installation. If a developer changes a machine or gets a new user id, such properties have to be copied manually to these newer machines.
Would it be possible to store user specific setting information in the repository itself (say SVN) and somehow have the mvn scripts load it on startup.
If the content of the settings.xml is not that user specific (e.g. for mirrors), you could store the whole Maven install in SVN with a customized conf/settings.xml and have the developers grab it from SVN to "install" it on a new machine as described in this previous answer.
If the content of the settings.xml is really user specific (e.g. it contains secret things like passwords), then it must be located in ~/.m2 and you will have to somehow make it available at the new location. If a developer logs on another machine, you could use "Roaming user profile". If a developer gets another id, then you'll really have to duplicate it. The technical solution may depend on the level of confidentiality required.
And if you have several developers sharing a userid but still need different settings.xml, then you'll have to pass it to Maven using the -s option. One could imagine storing these custom settings.xml in the project in that case (assuming it doesn't contain sensitive information). For example:
mvn -s settings-user1.xml <goal>
Nope, the whole point of having user settings is to store them outside the maven projects. There's nothing stopping you from creating your own svn repository and storing your configuration files there, though. You could write some shell scripts to bootstrap a new workstation from that repository, but it really depends how often you do this to make it worthwhile.
I would suggest that you setup your own repository such as Archiva, Nexus or Artifactory. Which will get your dependencies/plugins , then you can use mirror to specify explicitly just one repository to be used(the one you setup on your network). So whenever developer changes machine or dependencies are needed for multiple developers the internal mirror can be used as repo, your dependencies/plugins will download in no time to your local repository/ies

Nexus: removing repository

I accidently removed a hosted snapshot repository from Nexus containing a few artifacts needed by other developers on my team. Fine, I'll be able to recreate it fairly easy, but when I tried to add the repository again with the same name as the one I removed, the "Upload Artifact" tab did not show. I tried to clean the cache and reindex the public and public snapshot repos, but that didn't help. I also tried setting an alternative storage path by entering an alternative path on "Override Local Storage Location", same result.
Will I have to create a brand new repository with a different name and change all repository reference in my projects?
Thanks,
David
You should be able to create the new repo without any problem. It's possible you where inheriting permissions to this repo via a group and when you made the new repo you didn't add it to the group.
Also, all delete operations in Nexus simply move files to the sonatype-work/nexus/trash so you could have just copied all those files back directly on the disk after recreating the repo.
I think I noticed that snapshot repositories do not have the Artifact Upload tab, so possibly you created it as a snapshot repo?