Tagged Questions
1
vote
0answers
16 views
How to checkout a tag with GitPython
In a python script, I try to checkout a tag after cloning a git repository.
I use GitPython 0.3.2.
#!/usr/bin/env python
import git
g = git.Git()
g.clone("user@host:repos")
g = git.Git(repos)
...
0
votes
0answers
39 views
Using (or abusing?) GitPython
I've created a custom widget in wxPython which though not yet perfect, is good enough to add to one of my projects (call this widget v1.). I want to keep working on/experimenting with the widget, but ...
1
vote
3answers
163 views
Finding the first commit on a branch with GitPython
I'm writing a git post-receive hook using Python and Git-Python that gathers information about the commits contained in a push, then updates our bug tracker and IM with a summary. I'm having trouble ...
0
votes
1answer
95 views
Does GitPython works with Python 3.x?
If "yes", is there any difference when it's used with Python 2. ?
I found this, but I would say the answer isn't clear for me.
Thanks.
0
votes
1answer
68 views
GitPython: Determine files that were deleted in a specific commit
Using gitpython, I am trying to get a list of changed paths; that is, of all the added, changed and deleted files.
I can retrieve the changed and added files from the commit:
checkout commit 'X'
...
1
vote
1answer
85 views
How to get count of unpublished commit with GitPython?
With git status I can get information about count of unpublished commits:
ยป git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
# (use "git push" to ...
0
votes
1answer
77 views
How can I specify the committed_date of a Commit using GitPython?
I would like to commit a file with a custom date.
So far I've created a Commit object, but I don't understand how to bind it to a repo.
from git import *
repo = Repo('path/to/repo')
comm = ...
1
vote
1answer
149 views
Edit a commit with gitpython
Lets say you're in the terminal, currently sitting at the root of a git repo.
If you've got GitPython installed, you can do this to get the last committed commit, or rather, the commit that HEAD ...
0
votes
0answers
153 views
Git commit from Python with GitPython delete files committed from command line
Here is the code I use to create a new file and commit it :
# We are inside a home-made class, using GitPython
# So self.repo is a Repo() object from GitPython module
def set_content(self, path, ...
2
votes
1answer
162 views
gitpython error when checking if repo is dirty
I receive an error while trying to use gitpython to check if a repository is dirty, i.e. has uncommitted changed to tracked files:
import git
repo = git.Repo('')
print repo.is_dirty()
The error:
...
2
votes
1answer
81 views
gitpython creating zip archive
How can I create an archive with gitpython, I tried the following which creates the file but I can't open it it tells me an error occurred reading archive the archive appears to be invalid or damaged
...
1
vote
1answer
502 views
How can I pull a remote repository with GitPython?
I am trying to find the way to pull a git repository using gitPython.
So far this is what I have taken from the official docs in ...
2
votes
0answers
169 views
GitPython equivalent of “git remote show origin”?
I'm trying to update a Python script that checks the status of a handful of local repositories against remotes from using subprocess to using GitPython. What is the equivalent command in GitPython for ...
0
votes
1answer
124 views
How to do a git reset --hard using gitPython?
Well the title is self explanatory. What will be the python code equivalent to running git reset --hard (on terminal) using GitPython module?
1
vote
2answers
438 views
how to automate a push to repo using gitpython
I am trying to make a python script which would check for changes in my git local working folder, and automatically push them to the online repo. Currently only using git manually to do it. I want to ...
2
votes
2answers
266 views
cannot follow the python git tutorials
I have lately installed python-git package, and when trying to follow the tutorials over at the following link, I find that certain methods are missing...
...
3
votes
1answer
546 views
Using GitPython module to get remote HEAD branch
I'm trying to use GitPython to write some Python scripts which I can use it to simplify my daily tasks as I manage many branches.
I'm also quite new for Python when it comes to writing complicated ...
0
votes
1answer
2k views
OSError: [Errno 2] No such file or directory on GitPython
I am using GitPython to fetch a remote repository to my machine. The following code works well on my Ubuntu 12.04 but on my amazon ec2, on a Ubuntu 11.10 server, I get the OSError: [Errno 2] No such ...
1
vote
2answers
345 views
How do you define the host for Fabric to push to GitHub? (updated)
Original Question
I've got some python scripts which have been using Amazon S3 to upload screenshots taken following Selenium tests within the script.
Now we're moving from S3 to use GitHub so I've ...
5
votes
2answers
870 views
git log --follow, the gitpython way
I am trying to access the commit history of a single file as in:
git log --follow -- <filename>
I have to use gitpython, so what I am doing now is:
import git
g = git.Git('repo_dir')
...
1
vote
1answer
379 views
python doesn't get environment variable but it is set on mac os
if I run env command I obtain this output:
TERM_PROGRAM=Apple_Terminal
GPG_AGENT_INFO=/Users/paganotti/.gnupg/S.gpg-agent:346:1
TERM=xterm-color
SHELL=/bin/bash
...
2
votes
1answer
592 views
GitPython: get list of remote commits not yet applied
I am writing a Python script to get a list of commits that are about to be applied by a git pull operation. The excellent GitPython library is a great base to start, but the subtle inner workings of ...
0
votes
1answer
166 views
Reverting local changes to a file using GItPython
Is there a way under the GitPython library to revert local changes to a single file?
Under the Git command line I would just use git checkout filename but attempting to do this under the GitPython ...
1
vote
1answer
252 views
Get all commits when pushing to server
I am making a git post-commit hook to post my commit messages to Twitter. I have set up the hook on the server, which means it only runs when I call git push.
To interface with git from python, I am ...
2
votes
1answer
523 views
Git Python Cannot find Commit
I am not able to find a commit that a tag points to by navigating the commit tree. For this specific example, I am using the Tornado Web repository cloned directly from Github.
import sys
import git
...
10
votes
2answers
2k views
Python os.getlogin problem
If i create a file like:
import os
print os.getlogin()
and run it with cron, I get an exception
print os.getlogin()
OSError: [Errno 22] Invalid argument
If I run it manually in shell -- it ...
4
votes
1answer
531 views
How to import the Python async module from a worker thread?
I'm using the GitPython package to access a Git repository from Python. This pulls in the async package. In async/__init__.py, the following happens:
def _init_signals():
"""Assure we shutdown ...