You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to disable auto-fetching (background fetching) in Desktop #1128
I would love the option to be able to turn off the app fetching the latest changes for me, or really any automatic git command done on my behalf. My main use case for the app is to have a pretty diff of the changes I'm about to commit. I do much of my other work, like resolving conflicts and updating a branch with the latest master, via the terminal. I often hit errors when I do a flow like git pull; git checkout master; git pull; git checkout -; git merge master that I think are caused by the app trying to run git commands at the same time I am:
Already up-to-date.
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
error: cannot lock ref 'refs/remotes/origin/acceptance-saml': is at 00617906cd4ddf0ffdf2391f4c77187406a9b38a but expected 181445860d11aaeb13b0a281d42e59610e6499e2
From https://github.com/github/github
! 181445860d1..00617906cd4 acceptance-saml -> origin/acceptance-saml (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/lw-manage-listings': is at bde39ce0be0b9b4049a575892d705e440744068e but expected 38318bd501856d9f15119d7f6ef77f9a54427e89
! 38318bd5018..bde39ce0be0 lw-manage-listings -> origin/lw-manage-listings (unable to update local ref)
I can get around these errors by rerunning my command, but it's frustrating when they occur because it feels like I'm wrestling with the GitHub app being open. I'd like to be able to leave the app open since I commit frequently and love the diff view, but I'd also like to be in control of when it runs git commands.
Reacted by Alireza Habibi, Michael Keck, Timothy Solomon, Theodore Keloglou, Kevin King, Wiktoria Dalach, Sanders Lauture, Greg Wang, Jason Allan, jm3 and 27 more
Reacted by Michael Keck, Mahesh Bandara Wijerathna, moeenio, Alice Zoë Bevan–McGregor, Eugene Belinski, Madhu Rapolu, Alex Goller and Ashutosh Verma
@cheshire137 I think it's a different sort of error that occurs when Git operations collide - I opened #908 a while ago when I was seeing VSCode (which does Git operations in the background) interfering with my CLI usage (as well as Desktop:TNG).
Is this cannot lock ref error something you see daily? I've only been able to trigger this a couple of times from git fetch in the past few months, so I'm not sure how to consistently reproduce it (aside from maybe doing github/github work, lol).
At this point we don't have plans to do any background Git operations, but we don't enforce this currently. I think we do some refreshing (invoking git status) when you focus the app again, but my memory is a bit hazy.
Is this cannot lock ref error something you see daily?
I'd say daily, yeah. A few times a day sometimes.
I think we do some refreshing (invoking git status) when you focus the app again
That might help, actually, if the automatic refreshing were only done when the app has focus, since I'd be staying in my term and not using the app while doing git commands myself. If you think that's the problem I'm experiencing. 🤔
It's the side effects of the background fetching that bother me, so the ref locked error. The app can do what it likes so long as it doesn't interfere with the git commands I run myself. 😺
@desktop/core I'm curious what you all think. In Classic we didn't throttle background fetching while the app was in the background, but it is pretty weak if we interfere with command line usage (or other apps) while the app isn't active.
Please! This is a show-stopper for me, I have a lot of remotes and GD tries to fetch them all at startup which cripples my internet connection. If there is an option, it should also consider auto-fetch only the current branch. And when I do choose to update all remotes it'd be nice if it run in parallel -- git remote update --prune does it sequentially.
I think an option to separate fetching and pulling would be great actually.
Fetch - show the changes that can be pulled from the branch. A preview of sorts
Pull - pull the changes from the remote branch to have them merged locally
Right now I can only pull without knowing what I am pulling. I have to go to the website to see what are those changes...
@cheshire137 thinking about this again, this really feels like it aligns with the offline mode that's been suggested in #3854, except your use case is that you want to block any network activity that the app might run.
If you're 👍with that, I'll roll this feedback into that.
@shiftkey I understand what you're saying, and I disagree :)
What we're asking for is a prefs toggle, e.g. "Auto-fetch every N seconds", which defaults to On, and if toggled off, then Fetch (or Pull, insert appropriate git verb here) would only run when the Sync button is clicked. Basically a managed entry point to throttle DefaultFetchInterval and friends.
Implementing a complete offline mode sounds like a bit of a scope expansion from "I would prefer this app to NOT run git fetch every N seconds", although I defer to the maintainers' familiarity with the codebase.
I feel remiss if I don't anchor this discussion in my understanding of Git, viz. Git is designed to work with decentralized, intermittently connected teams. So the assumption by the app that a constant low-interval fetch is OK seems a teeny bit fishy.
My $0.02, feel free to destroy my argument.
Reacted by Alireza Habibi, Michael Keck, Spencer Morris, Mike, Dan C and Josh Esbrook
Many-seat GitHub Enterprise Server customer here. This is contributing to reduced performance of our on-prem GitHub installation. Your own support teams strongly recommend avoiding polling GitHub and using web hooks instead, yet GitHub's own product does very expensive fetches. You may imagine that 100+ GitHub Desktop users with 200+ repos checked out each will generate very noticeable load on the server.
This would ideally either:
Default to off
Be overridable by group policy in Windows, or at least a simple config flag we can tweak on install from a Chocolatey package or similar when installing it
Be significantly more intelligent (fetch repo only when the app is in the foreground, not fetch repos unless they have been looked at in the client in the last day or so, etc.)
Reacted by Alice Zoë Bevan–McGregor, cypress evelyn masso, Russ Whitchurch, Cale Bickler, Jan Brasna and James Chaldecott
Thanks so much for sharing that and sorry it's causing problems for you @herebebeasties. We discussed this last week as part of our planning process and we're planning to investigate the most expensive parts and discuss ways to alleviate those. You sharing your situation and the suggestions you provided are really helpful, and I really appreciate it!
Auto fetching also causes issues with git worktree's, resulting in a git state where the previously committed changes are back as staged changes on one of the worktrees. This requires a git reset . && git checkout . to get back to a usable state.
Having an option to disable auto fetching would also solve that issue, until better support for git worktrees in general is available.
Additionally, revisiting this issue would be appreciated too: #5764
@alexweissman Automatic repeated utilization of an SSH key for communication may give the false impression things are being pushed, especially if it's actually a pull and not a fetch, as the result may generate an automatic merge commit. If you then utilize commit signing, as I do, this will absolutely trigger a key unlock and signing event, also seemingly making changes or pushing them, but while the merge commit might be generated, it's not actually pushed. This is how GitHub Desktop PIN/PUK locked one of my hardware tokens. That token was a useful $40 or so investment. While it wasn't e-fuse bricked after repeated unexpected PIN unlock requests seemingly out of the blue bleary-eyed at 04:00.
That's how this failure scenario should be working. That I can say "I hope" or "should" to a bug this bad being not quite as bad as it seems… really not a good sign. There are also potentially outside influences, e.g. .git/hook hooks automatically doing things. (I have pre-commit hooks used pretty extensively, and a few of those are permitted to make changes to the Git stage automatically…)
I really do find myself asking why I keep this application installed. I should just be using Working Copy if a GUI is needed, as it really is a rare enough event. It's almost never needed. In its current state, it's not even convenient.
I am running into issues causing lots of traffic to our enterprise GitHub server by using GitHub Desktop. Please give us the option to run off background polling!
Another issue I'm experiencing with auto fetching; when I reset a commit locally, but that commit was pushed before, GitHub desktop can pull that same commit again, and alter the state of my local copy, which is undesired.
I don't really get how this issue has been open for so long.
Would a PR that adds a checkbox to the settings for disabling auto fetching be accepted?
Reacted by Christopher Allen, Michael Keck and Dan C
Hi folks, I wanted to provide a quick update here. Yesterday we shipped GitHub Desktop 2.5.6 which included the ability to disable background refresh of all tracked repositories in the app. See #10593 for the technical details.
In addition to being able to disable, we've also made several performance improvements to the background updates (#10119, #10588).
I hope that this will provide some relief to those of you who have many repositories. I've opened #10687 to track the work of allowing disabling background fetch of the currently selected repository but the preliminary data we have suggests that the changes we made in #10593, #10119, and #10588 should have a significant impact especially for those of you who have many repositories tracked in the app.
This issue has expanded in scope significantly since it's creation and covers both users with many repositories, enterprise scenarios, ssh remotes with automatic 2fa prompts, and more and it's hard to get a good overview of the various use cases. As such I'm going to repurpose it to deal with the many-repositories scenario which I hope we've handled with #10593 and ask that those of you who're looking to disable all types of background fetching head over to #10687 where we can focus solely on that issue. There's also #3410 which tracks background software updates.
Reacted by Quentin and 小新
Reacted by Alice Zoë Bevan–McGregor
Reacted by Eugene Belinski, Ashur Cabrera, tustin2121, 小新, Russ Whitchurch, Matt Acosta, Cale Bickler and Josh Esbrook
Thank you for your work on the enabling the ability to disable the 'fetch' in the UI. The problem I have in my environment we want to release this updated to 1000+ machines. Asking people to press this button is not feasible for ourselves. Can there be a way that this can be enabled/disabled within
Hey @shofwan. The title and description has changed from when we initially shipped this. Where it previously said "Periodically fetch and refresh status of all repositories" it now says "Show status icons in the repository list". See #17389 for more context on the change.
Activity
shiftkey commentedon Apr 4, 2017
@cheshire137 I think it's a different sort of error that occurs when Git operations collide - I opened #908 a while ago when I was seeing VSCode (which does Git operations in the background) interfering with my CLI usage (as well as Desktop:TNG).
Is this
cannot lock referror something you see daily? I've only been able to trigger this a couple of times fromgit fetchin the past few months, so I'm not sure how to consistently reproduce it (aside from maybe doing github/github work, lol).At this point we don't have plans to do any background Git operations, but we don't enforce this currently. I think we do some refreshing (invoking
git status) when you focus the app again, but my memory is a bit hazy.cheshire137 commentedon Apr 5, 2017
I'd say daily, yeah. A few times a day sometimes.
That might help, actually, if the automatic refreshing were only done when the app has focus, since I'd be staying in my term and not using the app while doing
gitcommands myself. If you think that's the problem I'm experiencing. 🤔joshaber commentedon Apr 5, 2017
I bet it's background fetching screwing you up here. I think it's pretty reasonable for us to throttle that when the app isn't focused.
@cheshire137 to be clear, does the background fetching itself bother you, or is it the ref locked error?
cheshire137 commentedon Apr 5, 2017
It's the side effects of the background fetching that bother me, so the ref locked error. The app can do what it likes so long as it doesn't interfere with the
gitcommands I run myself. 😺joshaber commentedon Apr 5, 2017
Cool, thanks @cheshire137!
@desktop/core I'm curious what you all think. In Classic we didn't throttle background fetching while the app was in the background, but it is pretty weak if we interfere with command line usage (or other apps) while the app isn't active.
alrz commentedon May 17, 2017
Please! This is a show-stopper for me, I have a lot of remotes and GD tries to fetch them all at startup which cripples my internet connection. If there is an option, it should also consider auto-fetch only the current branch. And when I do choose to update all remotes it'd be nice if it run in parallel --
git remote update --prunedoes it sequentially.shiftkey commentedon May 18, 2017
We'll push out #1435 soon which will stop this from occurring.
We're tracking #750 to do something similar to this - please comment there about that request.
IdanAdar commentedon Jun 13, 2017
I think an option to separate fetching and pulling would be great actually.
Fetch - show the changes that can be pulled from the branch. A preview of sorts
Pull - pull the changes from the remote branch to have them merged locally
Right now I can only pull without knowing what I am pulling. I have to go to the website to see what are those changes...
joshaber commentedon Nov 13, 2017
In #3306 @jm3 brought up the case where someone uses an external authenticator. They'll be pinged every time we do an auto-fetch
daveb-sentinelda commentedon Jan 30, 2018
Any update on this? I am on the latest version of the Desktop app for Mac and see no way to disable the auto fetch.
shiftkey commentedon Feb 28, 2018
@cheshire137 thinking about this again, this really feels like it aligns with the offline mode that's been suggested in #3854, except your use case is that you want to block any network activity that the app might run.
If you're 👍with that, I'll roll this feedback into that.
jm3 commentedon Mar 1, 2018
@shiftkey I understand what you're saying, and I disagree :)
What we're asking for is a prefs toggle, e.g. "Auto-fetch every N seconds", which defaults to On, and if toggled off, then Fetch (or Pull, insert appropriate git verb here) would only run when the Sync button is clicked. Basically a managed entry point to throttle
DefaultFetchIntervaland friends.Implementing a complete offline mode sounds like a bit of a scope expansion from "I would prefer this app to NOT run
git fetchevery N seconds", although I defer to the maintainers' familiarity with the codebase.I feel remiss if I don't anchor this discussion in my understanding of Git, viz. Git is designed to work with decentralized, intermittently connected teams. So the assumption by the app that a constant low-interval fetch is OK seems a teeny bit fishy.
My $0.02, feel free to destroy my argument.
ToddRopog commentedon Mar 5, 2018
Auto-fetching also prohibits using --force-with-lease: https://developer.atlassian.com/blog/2015/04/force-with-lease/
I would love to see the ability to disable auto-fetch entirely.
jm3 commentedon Mar 5, 2018
@ToddRopog thanks for clueing me into
git push --force-with-lease!35 remaining items
herebebeasties commentedon Jun 17, 2020
Many-seat GitHub Enterprise Server customer here. This is contributing to reduced performance of our on-prem GitHub installation. Your own support teams strongly recommend avoiding polling GitHub and using web hooks instead, yet GitHub's own product does very expensive fetches. You may imagine that 100+ GitHub Desktop users with 200+ repos checked out each will generate very noticeable load on the server.
This would ideally either:
billygriffin commentedon Jun 17, 2020
Thanks so much for sharing that and sorry it's causing problems for you @herebebeasties. We discussed this last week as part of our planning process and we're planning to investigate the most expensive parts and discuss ways to alleviate those. You sharing your situation and the suggestions you provided are really helpful, and I really appreciate it!
koenpunt commentedon Jun 22, 2020
Auto fetching also causes issues with
git worktree's, resulting in a git state where the previously committed changes are back as staged changes on one of the worktrees. This requires agit reset . && git checkout .to get back to a usable state.Having an option to disable auto fetching would also solve that issue, until better support for git worktrees in general is available.
Additionally, revisiting this issue would be appreciated too: #5764
Arlen22 commentedon Jun 29, 2020
How do I disable autofetch? Is this solved yet?
alexweissman commentedon Jul 17, 2020
Am I just imagining things, or does this also cause local commits to be automatically pushed sometimes as well?
steveward commentedon Jul 21, 2020
@alexweissman GitHub Desktop should not automatically push commits.
amcgregor commentedon Jul 22, 2020
@alexweissman Automatic repeated utilization of an SSH key for communication may give the false impression things are being pushed, especially if it's actually a pull and not a fetch, as the result may generate an automatic merge commit. If you then utilize commit signing, as I do, this will absolutely trigger a key unlock and signing event, also seemingly making changes or pushing them, but while the merge commit might be generated, it's not actually pushed. This is how GitHub Desktop PIN/PUK locked one of my hardware tokens. That token was a useful $40 or so investment. While it wasn't e-fuse bricked after repeated unexpected PIN unlock requests seemingly out of the blue bleary-eyed at 04:00.
That's how this failure scenario should be working. That I can say "I hope" or "should" to a bug this bad being not quite as bad as it seems… really not a good sign. There are also potentially outside influences, e.g.
.git/hookhooks automatically doing things. (I have pre-commit hooks used pretty extensively, and a few of those are permitted to make changes to the Git stage automatically…)I really do find myself asking why I keep this application installed. I should just be using Working Copy if a GUI is needed, as it really is a rare enough event. It's almost never needed. In its current state, it's not even convenient.
calebickler commentedon Jul 23, 2020
I am running into issues causing lots of traffic to our enterprise GitHub server by using GitHub Desktop. Please give us the option to run off background polling!
koenpunt commentedon Sep 6, 2020
Another issue I'm experiencing with auto fetching; when I reset a commit locally, but that commit was pushed before, GitHub desktop can pull that same commit again, and alter the state of my local copy, which is undesired.
I don't really get how this issue has been open for so long.
Would a PR that adds a checkbox to the settings for disabling auto fetching be accepted?
niik commentedon Sep 29, 2020
Hi folks, I wanted to provide a quick update here. Yesterday we shipped GitHub Desktop 2.5.6 which included the ability to disable background refresh of all tracked repositories in the app. See #10593 for the technical details.
In addition to being able to disable, we've also made several performance improvements to the background updates (#10119, #10588).
I hope that this will provide some relief to those of you who have many repositories. I've opened #10687 to track the work of allowing disabling background fetch of the currently selected repository but the preliminary data we have suggests that the changes we made in #10593, #10119, and #10588 should have a significant impact especially for those of you who have many repositories tracked in the app.
This issue has expanded in scope significantly since it's creation and covers both users with many repositories, enterprise scenarios, ssh remotes with automatic 2fa prompts, and more and it's hard to get a good overview of the various use cases. As such I'm going to repurpose it to deal with the many-repositories scenario which I hope we've handled with #10593 and ask that those of you who're looking to disable all types of background fetching head over to #10687 where we can focus solely on that issue. There's also #3410 which tracks background software updates.
ebelinski commentedon Sep 29, 2020
Thank you so much @niik!!! 🥳
chrisheselgrove commentedon Sep 28, 2021
Thank you for your work on the enabling the ability to disable the 'fetch' in the UI. The problem I have in my environment we want to release this updated to 1000+ machines. Asking people to press this button is not feasible for ourselves. Can there be a way that this can be enabled/disabled within
shofwan commentedon Jun 27, 2024
is this a Windows-only feature? Or is it for Enterprise users only?

Because I can't seem to find it on my Github:
niik commentedon Jun 27, 2024
Hey @shofwan. The title and description has changed from when we initially shipped this. Where it previously said "Periodically fetch and refresh status of all repositories" it now says "Show status icons in the repository list". See #17389 for more context on the change.