In the simplest terms, git pull
does a git fetch
followed by a git merge
.
You can do a git fetch
at any time to update your remote-tracking branches under refs/remotes/<remote>/
. This operation never changes any of your own local branches under refs/heads
, and is safe to do without changing your working copy. I have even heard of people running git fetch
periodically in a cron job in the background (although I wouldn't recommend doing this).
A git pull
is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.
From the Git documentation for git pull
:
In its default mode, git pull
is shorthand for git fetch
followed by git merge FETCH_HEAD
.
Doing this manually is no longer necessary, with modern versions of git
! See Malvineous's solution, below.
Reproduced here:
git remote set-url origin --push --add <a remote>
git remote set-url origin --push --add <another remote>
Original answer:
This something I’ve been using for quite a while without bad consequences and suggested by Linus Torvalds on the git mailing list.
araqnid’s solution is the proper one for bringing code into your repository… but when you, like me, have multiple equivalent authoritative upstreams (I keep some of my more critical projects cloned to both a private upstream, GitHub, and Codaset), it can be a pain to push changes to each one, every day.
Long story short, git remote add
all of your remotes individually… and then git config -e
and add a merged‐remote. Assuming you have this repository config
:
[remote "GitHub"]
url = git@github.com:elliottcable/Paws.o.git
fetch = +refs/heads/*:refs/remotes/GitHub/*
[branch "Master"]
remote = GitHub
merge = refs/heads/Master
[remote "Codaset"]
url = git@codaset.com:elliottcable/paws-o.git
fetch = +refs/heads/*:refs/remotes/Codaset/*
[remote "Paws"]
url = git@github.com:Paws/Paws.o.git
fetch = +refs/heads/*:refs/remotes/Paws/*
… to create a merged‐remote for "Paws"
and "Codaset"
, I can add the following after all of those:
[remote "Origin"]
url = git@github.com:Paws/Paws.o.git
url = git@codaset.com:elliottcable/paws-o.git
Once I’ve done this, when I git push Origin Master
, it will push to both Paws/Master
and Codaset/Master
sequentially, making life a little easier.
Best Answer
I also had this issue. Because I was trying to pull an organizations repo which was also private I needed to be granted access by the organization to use GitKraken (since it is seen as a third-party). If you go to your Github settings and under Applications -> Authorized OAuth App -> GitKraken thats where you can apply for permissions to the specific organizations you are assigned to on Github.
Hope this helps!