ryuslash / git-auto-commit-mode

Automatically commit to git after each save
http://projects.ryuslash.org/git-auto-commit-mode/
GNU General Public License v3.0
167 stars 26 forks source link

git-auto-commit-mode does commit but i cant push #9

Closed zeltak closed 8 years ago

zeltak commented 8 years ago

Hi

thx for this package, its fantastic and exactly what i need

i do have one question and this maybe due to my lack of really understanding how git works ;-)

i have the following config (setq-default gac-automatically-push-p t) set and add this on top of a local file ;; -*- eval: (git-auto-commit-mode 1) -*-

this does work well yet fails to push. the reason i suspect is that the root git folder is at ~/org and the specific file is at ~/org/agenda/file.org is that the reason? and if so how does one define where to run the push command?

best!

z

ryuslash commented 8 years ago

Hey!

Thanks for your kind words and opening this bug report, I'm sorry you're having trouble.

Normally it shouldn't matter where in the git repository push is called. git-auto-commit-mode just calls git push and requires the git repository to have a proper upstream setup. If you use the command-line to call git push in the ~/org/agenda directory, does that work?

zeltak commented 8 years ago

Hi again thanks for the quick answer :)

yes you are right, if i go into the ~/org/agenda directory and issue git push it does seem to push

zeltak@zx1voics agenda ↳ git push                            
Counting objects: 4, done.                                   
Delta compression using up to 4 threads.                     
Compressing objects: 100% (4/4), done.                       
Writing objects: 100% (4/4), 389 bytes | 0 bytes/s, done.    
Total 4 (delta 3), reused 0 (delta 0)                        
To git@gitlab.com:zeltak/org.git                             
   6897566..9c85707  master -> master                        

yet again if i dont manually push via the command line the changes (which i see are committed) dont get pushed.

I do see an error looking at the message buffer:

[master 0c01b74] agenda/meetings.org
 1 file changed, 2 insertions(+)
git exited abnormally with code 128

any clue how to further debug this :)

thx again for this package, its truly amazing :)

best

Z

ryuslash commented 8 years ago

Sorry for the late response. Do you use a keychain or something similar perhaps? Something so you don't need to type in your password/passphrase each time you do a git push?

zeltak commented 8 years ago

Hi

yes in fact i do use a keychain on arch linux at login and as you say i dont need to type my passphrase each time. is that the problem?

best

Z

ryuslash commented 8 years ago

I'm not sure. Normally it should ask for a passphrase. Also if Emacs is started from your user session it should just use the keychain I think. Can you try a git push from the command line without having the keychain on by any chance?

zeltak commented 8 years ago

hi

ok when killing ssh-agent i get the following when i try to push

 git push                                                                         master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
zeltak@zx1voics .emacs.d ↳  

with ssh-agent after entering my passphrase into the keyring i get no such error

does that help?

z

ryuslash commented 8 years ago

How do you start Emacs and ssh-agent? From your window manager/desktop environment, via the command line or with a systemd service?

zeltak commented 8 years ago

Hi

emacs is started as a daemon with systemd using arch linux, ie: `systemctl --user start emacs``

the ssh-agent is started on login from my zshrc

#--------------> keychain
#to ask for both keys at startup
eval $(keychain --eval --agents ssh -Q --quiet id_rsa id_rsa_github)

thx

Z

ryuslash commented 8 years ago

I thought you might be starting it with systemd.

Environment variables aren't normally imported into user services this way. I don't know off the top of my head which environment variables are set when you call keychain, but if you can find out and call systemctl --user import-environment VARIABLES, replacing VARIABLES with the environment variables that are required. Personally I use this to get the right PATH and INFOPATH variables in Emacs: systemctl --user import-environment PATH INFOPATH.

zeltak commented 8 years ago

Hi

i can confirm that when i start emacs --daemon via xinit it works! i guess ill just start emacs that way?

best

Z

ryuslash commented 8 years ago

I think that, or make find a way to make those keychain variables available in your systemd service. Other than the import-environment example I showed before (which requires running the keychain command before it and (re)starting the Emacs service after it), I can't think of a way to do that right now.