13

I am using the git-emacs to submit code to github throug Emacs. It is ok for add and commit, but it seems that git-emacs do not support the git push operation. When I type M-x git-push, it responds with "no such command".

N.N.
  • 8,336
  • 12
  • 54
  • 94
zolibra
  • 532
  • 6
  • 16

5 Answers5

8

You're right, it doesn't. However, magit can push.

khagler
  • 3,996
  • 29
  • 40
  • 1
    so i turn to magit , but i still fail to push , it is ok to stage and commit , but when i type P P to do a git push , it just said: "git push -v ...... " in the console , it did not really push anything into the repository, could you help with this also? – zolibra Dec 07 '12 at 06:01
  • There is a problem with github: https://github.com/magit/magit/pull/433 Check by pressing `$` whether Magit hangs on login. Update to newest Magit, and if this doesn't help -- well pushing is just a couple of keystrokes in the shell... – lukstafi Mar 18 '13 at 23:02
7

Newer versions of Emacs provide the command:

C-x v P

longer version:

M-x vc-push

(as noted by @CAT0). If your version of Emacs doesn't support that command, try:

M-& git push [Enter]

longer version:

M-x async-shell-command [Enter] git push [Enter]

As pointed out by @mariotomo this is better than the synchronous version below because it opens a buffer for the output.

M-! git push [Enter]

longer version:

M-x shell-command [Enter] git push [Enter]

(M- is short for "Meta key" which can be Esc or Alt or Ctrl+[).

(and if you're on Windows and hesitate to use the shell which goes to a nasty DOS shell by default, try running Emacs as emacs-w32 from Cygwin, things will be saner).

Kai Carver
  • 2,240
  • 29
  • 23
  • 1
    even better, use `M-&` so emacs won't be stuck waiting for git to complete, and a buffer will appear with the output of the command. – mariotomo Jul 29 '17 at 21:40
3

In emacs 25 (maybe also earlier) there is the command

vc-push

which does exactly what it should. It is bound to C-x v P

CAT0
  • 31
  • 1
1

This is an unfortunate side effect of the fact the built-in Emacs VCS support(vc-mode) is mostly built for tools like cvs, subversion, etc that have a totally different workflow. DVCS support was added fairly soon (in Emacs 23). I hope vc-mode will be improved in the near future. Until then...

As @khagler said Magit supports git push. Another solid option for you to explore is Egg.

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
1

By git-emacs, you can push in the following way:

  1. M-x git-cmd, which is bound to C-x g . ( In git-status window it is bound to .)
  2. type in push
Chromatic
  • 143
  • 6