You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue with pulling a repo, and I'm pretty sure it has to do with me using a new version of either GitPython or Git (it worked previously).
Here's the relevant snippet:
# Attempt to read from repo on filesystemrepo=Repo(repo_dir)
# Trigger re-create if repository is bareifrepo.bare:
raisegit.exc.InvalidGitRepositoryError# Set originorigin=repo.remotes.originorigin.pull()
In this case, I am trying to check out a git tag that already exists, and I want to run a "pull" to ensure I have the latest changes from that target. As I mentioned, it was working previously - but something changed, causing the following stack trace (which originates from that last line in the above example):
Traceback (most recent call last):
File "/usr/lib/python2.7/<project>.py", line 44, in setup_repo
origin.pull()
File "/usr/local/lib/python2.7/dist-packages/git/remote.py", line 709, in pull
res = self._get_fetch_info_from_stderr(proc, progress)
File "/usr/local/lib/python2.7/dist-packages/git/remote.py", line 587, in _get_fetch_info_from_stderr
finalize_process(proc)
File "/usr/local/lib/python2.7/dist-packages/git/util.py", line 155, in finalize_process
proc.wait(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/git/cmd.py", line 326, in wait
raise GitCommandError(self.args, status, errstr)
GitCommandError: 'git pull -v origin' returned with exit code 1
Naturally, I ran the same command in that repo and get the same result:
vagrant@pythondev:/tmp/repo_dir/v0.0.0.26$ git pull -v origin
From < git remote >
= [up to date] master -> origin/master
You asked to pull from the remote 'origin', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
As provided in the error message, I just need to specify the tag like so: git pull -v origin v0.0.0.26. However, upon looking at what I believe is the source code behind the GitPython .pull() function, it's not clear if I am able to specify this argument to that function.
So, in summary, is there a way to specify the branch or tag that I wish to pull when I use the .pull() function? Thanks in advance!
The text was updated successfully, but these errors were encountered:
WOW - I feel quite silly about missing the "refspec" argument right there in the function definition. It's the first argument! Easily fixed by simply changing the "pull" line to:
origin.pull("v0.0.0.26")
A big nevermind on this! I would say that I feel this is a reasonably common operation, so while this is certainly well documented in the API docs, it may be worth adding this as a brief example to the tutorial.
Great to hear this worked out for you :) (and sorry for the late reply).
You are probably right, certain things could be made clearer in the tutorial. Considering you ran into this, you should be the one to know best what would have helped you.
Therefore, if you would like to submit a PR, I will be here to merge it.
Thanks and cheers
I'm having an issue with pulling a repo, and I'm pretty sure it has to do with me using a new version of either GitPython or Git (it worked previously).
Here's the relevant snippet:
In this case, I am trying to check out a git tag that already exists, and I want to run a "pull" to ensure I have the latest changes from that target. As I mentioned, it was working previously - but something changed, causing the following stack trace (which originates from that last line in the above example):
Naturally, I ran the same command in that repo and get the same result:
As provided in the error message, I just need to specify the tag like so:
git pull -v origin v0.0.0.26
. However, upon looking at what I believe is the source code behind the GitPython.pull()
function, it's not clear if I am able to specify this argument to that function.So, in summary, is there a way to specify the branch or tag that I wish to pull when I use the
.pull()
function? Thanks in advance!The text was updated successfully, but these errors were encountered: