Tag: python

Git pre-commit hook to regenerate a file and reject the commit if there are diffs

My situation is (roughly analogous to) the following: We have the directory structure my-repo/ input.txt output-1.bin output-2.bin output-3.bin converter.py For simplicity, let’s say that converter.py looks like this: #/usr/bin/env python from shutil import copyfile copyfile(‘input.txt’, ‘output-1.bin’) copyfile(‘input.txt’, ‘output-2.bin’) copyfile(‘input.txt’, ‘output-3.bin’) We version-control both input.txt and output-*.bin. I know, I know, you’re going to say that […]

npm not functioning after installing python 3.5 and reinstalling both Git and npm on Windows

I had node.js and npm working fine till I installed python 3.5 and probably missed up with my path (manually) . git didnot recognise npm ; after I added “C:\Users\n17263” to my path npm was found by git. But it does not install any package successfully. Here is the Error screen after tying “npm install […]

Saving the stdout of gitpython calls?

directory = repo.directory r = git.Repo(directory) if r: r.git.reset(‘–hard’) if r.remotes[repo.remote]: r.remotes[repo.remote].pull() I want to save the stdout of any operation on my r object, including any .reset or .pull calls – how can I go about doing this?

Python: git remote add with Dulwich

i use git to remote data. This is my code. from dulwich.repo import Repo from dulwich.server import DictBackend, TCPGitServer repo = dulwich.repo.Repo.init(‘remote’, mkdir=True) backend = DictBackend({‘/’: repo}) dul_server = TCPGitServer(backend, ‘git://server.com/file.git’, 0) threading.Thread(target=dul_server.serve).start() server_address, server_port = dul_server.socket.getsockname() client = dulwich.client.TCPGitClient(server_address.encode(‘ascii’), server_port) remote_refs = client.fetch(‘/’, remote) But I get the error: socket.gaierror: [Errno -2] Name or […]

GitPython: check if git is available

GitPython depends on having the command line version of git installed (otherwise, you get the issue in this question: OSError: [Errno 2] No such file or directory on GitPython). Is there any way from the GitPython API to check if the executable is found, or, do you need to wrap all GitPython calls in exception […]

GitPython error when pulling from remote repository

I’m trying to pull from a remote repo in a local one with this code: repo = git.Repo(‘/home/user/repo/’) o = repo.remotes.origin try: o.pull() except: logging.exception(“oops:”) This fails miserably with the following traceback: Traceback (most recent call last): File “/home/user/my_site/app/app.py”, line 58, in regen_logs o.pull() File “/home/user/my_site/venv/lib/python2.7/site-packages/git/remote.py”, line 665, in pull proc = self.repo.git.pull(self, refspec, with_extended_output=True, […]

Moving an application from Django 1.4 to 1.8

I had a previous project running on Django 1.4 and I am now trying to “revive it”. Specifically my system at that time was OS-X and running BITNAMI DJANGO STACK 1.4.6 (Python 2.7) . I have pulled the source code from the Git repository into a fresh install of BITNAMI DJANGOSTACK 1.8 https://bitnami.com/stack/django/installer#osx Ideally, I […]

Problems with database after cloning Django app from Github

Bare with me; I am new to git, GitHub, and Django alike. I have just cloned a Django app from Github to a local directory. I know for a fact that the app works because I’ve run it on others’ computers. When I run the server, I can see the site and register for an […]

python, project structure to test separate git library

Suppose I have a private git repo(A library repo) which I want to use from my project. (B project repo) I clone A to my ~/workspace/A and I work on my project at ~/workspace/B B ‘s virtualenv resides in ~/virtualenvs/B In order to modify A and test the modified from B, modify A commit push […]

Preventing access to specific file for specific user in git

Imagine we have a team that we are using a project in git and we have remote access to the repoitory. The structure of project is: project/ install.sh readme changelog project.odt src/ project.py modules/ a.py b.py c.py Now: git init Imagine I am an admin of project. I want to set permissions on file for […]

Git Baby is a git and github fan, let's start git clone.