Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use multiple remotes with GitKraken

I'm using GitKraken quite frequently, but I cannot manage how to set to which remote I want to push. In the context menu I cannot find any entry like "use this remote for push/pull".

I have to set it via the command line, then it works as expected.

git push -u origin2 dev/mybranch

is this really a missing feature?

like image 424
Karl Zeilhofer Avatar asked Jun 20 '17 09:06

Karl Zeilhofer


People also ask

Can a repository have multiple remotes?

You can add multiple remotes by using git remote or git config commands or editing the config file.

How do I add a second remote to 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.

How many remotes can git have?

You can have as many remote repositories as you want, but you must give them different names. The repository name is different in this case. Is the the word "origin" a name that can be changed? Yep, git remote rename <old> <new> : linux.die.net/man/1/git-remote.


1 Answers

  1. Right-Click on the local branch from which you want to pull, click on Set Upstream. Set Upstream

  2. Select the origin that you want to push, click submit. Select Origin

Now, pushing (clicking on the Push button) will push to the selected origin! And when you want to change the origin the next time, repeat the step-1 and push.

like image 172
Mihir Joshi Avatar answered Oct 10 '22 23:10

Mihir Joshi