0

I have just installed Magit and so far all is going great! However, I have a lot of GitHub repos that I would like to fetch via Magit. Is there a way to fetch all repos from GitHub?

1
  • I'm fairly certain this functionality doesn't exist, but my answer is far from authoritative. In case you're interested in a non-Emacs solution, I recommend Joey Hess' github-backup for this purpose.
    – Basil
    Commented Jun 17, 2017 at 22:38

1 Answer 1

2

Magit does not come with a command to do that, but implementing it is easy.

(defun my-magit-fetch-all-repositories ()
  "Run `magit-fetch-all' in all repositories returned by `magit-list-repos`."
  (interactive)
  (dolist (repo (magit-list-repos))
    (message "Fetching in %s..." repo)
    (let ((default-directory repo))
      (magit-fetch-all (magit-fetch-arguments)))
    (message "Fetching in %s...done" repo)))

You will have to customize magit-repository-directories to tell Magit about the repositories magit-list-repos should return

That function is also used when invoking magit-status with a prefix argument to jump to some repository and other things. If you want to only fetch in some of the returned repositories, then you will have to implement some filtering. This could for example be based on the value of (magit-get "remote.origin.url") to limit to only repositories from Github.

1
  • +1. Note that this assumes existing checkouts of the repositories in question; it does not automatically ascertain which repositories a particular user has on GitHub.
    – Basil
    Commented Jun 21, 2017 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.