Skip to content

Example on tutorial doesn't work #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
derekchiang opened this issue May 6, 2013 · 6 comments
Closed

Example on tutorial doesn't work #107

derekchiang opened this issue May 6, 2013 · 6 comments

Comments

@derekchiang
Copy link

I tried the example given here: http://pythonhosted.org/GitPython/0.3.2/tutorial.html

When I did this:

from git import *
repo = Repo("/Users/mtrier/Development/git-python")
assert repo.bare == False

This happened:

Traceback (most recent call last):
File "git.py", line 1, in
from git import *
File "/media/Work_Study/CS/workspace/Python/environments/autover2/git.py", line 2, in
repo = Repo("/Users/mtrier/Development/git-python")
NameError: name 'Repo' is not defined

@jakubczaplicki
Copy link

I've just installed "GitPython 0.3.2.RC1" - got identical issue "NameError: name 'Repo' is not defined".

from git import *
repo = Repo("./devtest")
python pygit.py
Traceback (most recent call last):
File "pygit.py", line 2, in <module>
    repo = Repo("./devtest") 
NameError: name 'Repo' is not defined

@jschlather
Copy link

I don't have this issue with gitpython, how did you install 0.3.2RC1? If it's pip can you print the output of

pip show GitPython

I've seen that when pip is installed via macports it won't install the release candidate.

@Byron
Copy link
Member

Byron commented Nov 19, 2014

I cannot reproduce this one, and believe that you might have accidentally installed an old version. However, the latest version was now updated to 0.3.2 on pypi ,which installs correctly.

@Byron Byron closed this as completed Nov 19, 2014
@92dbajaj
Copy link

Hi, guys, I have installed gitpython on Anaconda using conda, it's been installed properly. Still, I am getting the following error:
File "search.py", line 59, in
repo = Repo (Git_Repository)
NameError: name 'Repo' is not defined
Can anyone help, please?

@hick
Copy link

hick commented Nov 23, 2018

I got this error to, sth related:

image

text version:

D:\hick\python>python git-.py
Traceback (most recent call last):
File "git-.py", line 6, in
repo = git.Repo(r'D:\hick')
NameError: name 'git' is not defined

D:\hick\python>pip show GitPython
Name: GitPython
Version: 2.1.11
Summary: Python Git Library
Home-page: https://github.com/gitpython-developers/GitPython
Author: Sebastian Thiel, Michael Trier
Author-email: [email protected], [email protected]
License: BSD License
Location: d:\program\python35\lib\site-packages
Requires: gitdb2

D:\hick\python>cat git-.py
'''
操作 git 的演练
'''
from git import Repo

repo = git.Repo(r'D:\hick')

print(repo.bare)

D:\hick\python>python -V
Python 3.5.4

@smkplus
Copy link

smkplus commented Aug 29, 2020

before using GitPython make sure you have a repository on path
if you haven't a repository use this command git init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants