Tag: python

When working with a venv virtual environment, which files should I be commiting to my git repository?

Using GitHub’s .gitignore, I was able to filter out some files and directories. However, there’s a few things that left me a little bit confused: GitHub’s .gitignore did not include /bin and /share created by venv. I assumed they should be ignored by git, however, as the user is meant to build the virtual environment […]

Run Python Module from Source (Obtained via GitHub)

I am missing a key piece of understanding regarding the workflow needed to contribute to larger open source projects on the GitHub platform, and I am hoping someone may be able to explain. Essentially, I’d like to understand how to contribute to the scikit-learn repository. I am clear on how to fork the repo, update […]

GitPython — How to 'git stash' changes to a GitPython repository?

I have a repo created via GitPython library that has some uncommitted changes. I want to stash those changes. How do I do it? Searching for “stash” in the GitPython docs returned no results.

`git ls-remote` in GitPython

In my python program, I want to check whether a ref exists on my remote. I can check the remote with git ls-remote, but I would like to avoid parsing the output myself. I found git.remote.Remote in GitPython, but that only refers to a remote of a local repository. Does GitPython have an equivalent command […]

Unable to install the latest release candidate of a Python library on GitHub

I didn’t succeed installing the latest airflow release candidate. Specifically, running pip install -e git://github.com/apache/incubator-airflow.git@1.8.2rc4#egg=airflow on the CL ended with: File “/home/alex/Desktop/urban-physiology-toolkit/src/airflow/setup.py”, line 87, in git_version assert tag == version, (tag, version) AssertionError: (‘1.8.2rc4’, ‘1.8.2’) Followed by the usual pip FAIL redtext. The offending code line is a tag version check. Installing from HEAD works […]

Python: catch git error

I’m trying to catch a very simple error, but with no result for now. I’ve created a tag on my Git repository and trying to catch an error with the creation of existing tag. My code looks like: try: check_call([‘git’, ‘tag’, ‘-a’, ‘1.2.3’, ‘-m’, ‘test tag.’]) except CalledProcessError as err: print err.output, err.returncode, err.message I […]

Can't get stdout/stderr from (Python) subprocess.check_output()

I’m trying to get the message from a git add command, to print to a log file later on. import subprocess import os filename = ‘test.txt’ # Add changes add_cmd = “””git add “%s” “”” % filename os.system(add_cmd) a = subprocess.check_output(add_cmd, shell=True, stderr=subprocess.STDOUT) The os.system() call shows in screen: fatal: Not a git repository (or […]

Scripting git commands in Python without external library

I am trying to script a git pull without having to enter a username and password. How would I go about doing this? The only functionality I will be using from git is “git pull”.

How to get last commit for specified file with python(dulwich)?

I need author name and last commit time for a specified file with python. Currentrly, I’m trying to use dulwich. There’re plenty of apis to retrieve objects for a specific SHA like: repo = Repo(“myrepo”) head = repo.head() object = repo.get_object(head) author = object.author time = object.commit_time But, how do i know the recent commit […]

repo init UnicodeDecodeError on Ubuntu 13.04

I use repo-1.19: $ wget -nv ‘http://code.google.com/p/git-repo/downloads/detail?name=repo-1.19’ 2013-08-05 02:36:32 URL:http://code.google.com/p/git-repo/downloads/detail?name=repo-1.19 [9673] -> “detail?name=repo-1.19.3” [1] $ chmod +x repo-1.19 $ ./repo-1.19 –version repo version v1.12.2 (from https://gerrit.googlesource.com/git-repo) repo launcher version 1.19 (from /home/u/Téléchargements/repo-1.19) git version 1.8.1.2 Python 2.7.4 (default, Jul 5 2013, 08:21:57) [GCC 4.7.3] But when I try to initialize it I have the Python […]

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