Skip to content

Option to disable auto-fetching (background fetching) in Desktop #1128

Closed

Description

@cheshire137

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.

Activity

  1. shiftkey commented on Apr 4, 2017

    @shiftkey
    Member

    @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.

  2. cheshire137 commented on Apr 5, 2017

    @cheshire137
    ContributorAuthor

    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. 🤔

  3. joshaber commented on Apr 5, 2017

    @joshaber
    Contributor

    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?

  4. cheshire137 commented on Apr 5, 2017

    @cheshire137
    ContributorAuthor

    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. 😺

  5. joshaber commented on Apr 5, 2017

    @joshaber
    Contributor

    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.

  6. alrz commented on May 17, 2017

    @alrz

    Allow disabling auto-fetching

    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.

  7. shiftkey commented on May 18, 2017

    @shiftkey
    Member

    I have a lot of remotes and GD tries to fetch them all at startup which cripples my internet connection.

    We'll push out #1435 soon which will stop this from occurring.

    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.

    We're tracking #750 to do something similar to this - please comment there about that request.

  8. IdanAdar commented on Jun 13, 2017

    @IdanAdar

    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...

  9. joshaber commented on Nov 13, 2017

    @joshaber
    Contributor

    In #3306 @jm3 brought up the case where someone uses an external authenticator. They'll be pinged every time we do an auto-fetch :hurtrealbad:

  10. daveb-sentinelda commented on Jan 30, 2018

    @daveb-sentinelda

    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.

  11. shiftkey commented on Feb 28, 2018

    @shiftkey
    Member

    @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.

  12. jm3 commented on Mar 1, 2018

    @jm3

    @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.

  13. ToddRopog commented on Mar 5, 2018

    @ToddRopog

    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.

  14. jm3 commented on Mar 5, 2018

    @jm3

    @ToddRopog thanks for clueing me into git push --force-with-lease!

  15. 35 remaining items

  16. herebebeasties commented on Jun 17, 2020

    @herebebeasties

    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.)
  17. billygriffin commented on Jun 17, 2020

    @billygriffin
    Contributor

    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!

  18. koenpunt commented on Jun 22, 2020

    @koenpunt
    Contributor

    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

  19. Arlen22 commented on Jun 29, 2020

    @Arlen22

    How do I disable autofetch? Is this solved yet?

  20. alexweissman commented on Jul 17, 2020

    @alexweissman

    Am I just imagining things, or does this also cause local commits to be automatically pushed sometimes as well?

  21. steveward commented on Jul 21, 2020

    @steveward
    Contributor

    @alexweissman GitHub Desktop should not automatically push commits.

  22. amcgregor commented on Jul 22, 2020

    @amcgregor

    @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.

  23. calebickler commented on Jul 23, 2020

    @calebickler

    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!

  24. koenpunt commented on Sep 6, 2020

    @koenpunt
    Contributor

    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?

  25. niik commented on Sep 29, 2020

    @niik
    Member

    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.

  26. ebelinski commented on Sep 29, 2020

    @ebelinski

    Thank you so much @niik!!! 🥳

  27. chrisheselgrove commented on Sep 28, 2021

    @chrisheselgrove

    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

    1. A config file
    2. Windows Registry
    3. Group Policy
  28. shofwan commented on Jun 27, 2024

    @shofwan

    #10593

    is this a Windows-only feature? Or is it for Enterprise users only?
    Because I can't seem to find it on my Github:
    image

  29. niik commented on Jun 27, 2024

    @niik
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions