Installing from the Git Repository
Magit depends on the compat, cond-let, llama, seq (the built-in version is enough when using Emacs >= 29.1), transient and with-editor libraries which are available from Melpa and Melpa-Stable. Install them using M-x package-install RET <package> RET. Of course you may also install them manually from their repository.
Then clone the Magit repository:
$ git clone https://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit
$ cd ~/.emacs.d/site-lisp/magitThen compile the libraries and generate the info manuals:
$ makeIf you haven’t installed compat, cond-let, llama, seq (only for Emacs 28), transient and with-editor from Melpa, or at /path/to/magit/../<package>, then you have to tell make where to find them. To do so create the file /path/to/magit/config.mk with the following content before running make:
LOAD_PATH = -L ~/.emacs.d/site-lisp/magit/lisp
LOAD_PATH += -L ~/.emacs.d/site-lisp/compat
LOAD_PATH += -L ~/.emacs.d/site-lisp/cond-let
LOAD_PATH += -L ~/.emacs.d/site-lisp/llama
LOAD_PATH += -L ~/.emacs.d/site-lisp/seq
LOAD_PATH += -L ~/.emacs.d/site-lisp/transient/lisp
LOAD_PATH += -L ~/.emacs.d/site-lisp/with-editor/lispFinally add this to your init file:
(add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp")
(require 'magit)
(with-eval-after-load 'info
(info-initialize)
(add-to-list 'Info-directory-list "~/.emacs.d/site-lisp/magit/docs/"))Of course if you installed the dependencies manually as well, then you have to tell Emacs about them too, by prefixing the above with:
(add-to-list 'load-path "~/.emacs.d/site-lisp/compat")
(add-to-list 'load-path "~/.emacs.d/site-lisp/cond-let")
(add-to-list 'load-path "~/.emacs.d/site-lisp/llama")
(add-to-list 'load-path "~/.emacs.d/site-lisp/seq")
(add-to-list 'load-path "~/.emacs.d/site-lisp/transient/lisp")
(add-to-list 'load-path "~/.emacs.d/site-lisp/with-editor")Note that you have to add the lisp subdirectory to the load-path, not the top-level of the repository, and that elements of load-path should not end with a slash, while those of Info-directory-list should.
Instead of requiring the feature magit, you could load just the autoload definitions, by loading the file magit-autoloads.el.
(load "/path/to/magit/lisp/magit-autoloads")Instead of running Magit directly from the repository by adding that to the load-path, you might want to instead install it in some other directory using sudo make install and setting load-path accordingly.
To update Magit use:
$ git pull
$ makeAt times it might be necessary to run make clean all instead.
To view all available targets use make help.
Now see Post-Installation Tasks.