Search code examples
gitversion-controlemacs24

Repository Creation in Emacs Git


How could I create a repository in Emacs git, is there a Emacs command?

Just installed git.el in site-lisp directory but can't find this info anywhere.

Already managed to use a ready git repository, but couldn't create one from within Emacs.

Thanks!


Solution

  • How can i create a repository in Emacs git, is there a Emacs command?

    It doesn't look git.el supports this. It is focused around its git-status command, which prompts for a root directory and complains when you give it one that isn't already initialized.

    However, Emacs' built-in VC mode will do this with its vc-create-repo command:

    Create an empty repository in the current directory.

    Make sure to (require 'vc) somewhere, cd to the target directory (or visit a file in it), then M-x vc-create-repo RET. VC Mode supports many version control backends, so when prompted, type git (tab-completion is available here).

    Finally, there is an excellent Git mode called Magit that also supports creating repositories. If given a directory that isn't a repository, magit-status command will ask if you want to create one. Magit is available via MELPA.