logsol / Github-Auto-Deploy

a server that allows you to automatically deploy the latest version of your github project at each git push
http://logsol.github.com/Github-Auto-Deploy/
MIT License
575 stars 187 forks source link

Not a Git repository #24

Closed pawamoy closed 9 years ago

pawamoy commented 9 years ago

Hi !

When I start your script using python GitAutoDeploy.py, it tells me that the directory I specified in the conf file is not a git repo, but it is, actually. By quickly reading the code it seems that it searches for subdirectories objects or else, but these dirs are themselves in the subdir .git, so it can't find them, and it results with an error...

I manage to tweak it a bit in order to get it working but I still get exceptions from deploy function:

----------------------------------------
Exception happened during processing of request from ('192.30.252.46', 49160)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "GitAutoDeploy.py", line 47, in do_POST
    self.deploy(path)
  File "GitAutoDeploy.py", line 85, in deploy
    print 'Push to different branch (%s != %s), not deploying' % (repository['branch'], self.branch)
KeyError: 'branch'
----------------------------------------

So I removed all the lines involving branches or else, and now I get:

----------------------------------------
Exception happened during processing of request from ('192.30.252.46', 39946)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "GitAutoDeploy.py", line 46, in do_POST
    self.fetch(path)
  File "GitAutoDeploy.py", line 73, in fetch
    call(['cd "' + path + '" && git pull'], shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1376, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)
----------------------------------------

I don't understand why we have SocketServer errors when we just ask deploy to do echo deploying :(

logsol commented 9 years ago

Hi, I just had the same issue, for me it worked, when i removed the "/" before .git in line 31 https://github.com/logsol/Github-Auto-Deploy/blob/master/GitAutoDeploy.py#L31. If it works for you too, we should change this in the master.

awigen commented 9 years ago

I've issued a pull request to fix the issue.

mach-kernel commented 9 years ago

@logsol's fix works for me too. Please pull this into master!

logsol commented 9 years ago

done