Skip to content

NameError: name 'git' is not defined #811

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
hick opened this issue Nov 23, 2018 · 2 comments
Closed

NameError: name 'git' is not defined #811

hick opened this issue Nov 23, 2018 · 2 comments
Labels

Comments

@hick
Copy link

hick commented Nov 23, 2018

how can I debug something?

it's sth like this issue, while I think maybe different: #107

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

@Dotrar
Copy link

Dotrar commented Dec 13, 2018

if you import Repo from git you are importing Repo, not git.

just remove git.

@Byron Byron added the Q&A label Dec 22, 2018
@Byron
Copy link
Member

Byron commented Dec 22, 2018

I think @Dotrar has provided the answer to this question.

@Byron Byron closed this as completed Dec 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants