Cloned from colleagues computer, now pulls from bitbucket still loads a lot

We have a Git repository that is quite large, and we are behind a very slow internet connection.

My colleague already had the latest copy of the repository, so I did

git clone him:/home/foo/repo 

on a local network - it's fast :)

After that, he made some changes, so I did git pull . During this, I had conflicts with which I merged.

Then i did

 git remote rename origin him git remote add <BITBUCKETURL> 

I made some changes and tried

 git push origin master 

which was rejected (no fast forward).

So i tried

 git pull origin 

But now Git wants to download megabytes of data that I donโ€™t understand. I thought Git was smart enough to traverse the objects that it already has. Correctly? Also, I tried to clone and add the Bitbucket URL without merging; same problem.

What should I do to fix this?

EDIT to ask questions in the comments :

  • there are no other branches that I know about, git pull origin master has the same effect
  • Doing Git pull origin master print: remote: Counting objects: 1535 - there is no chance that there have been so many chances during this time.
  • I compared the log, there are no changes on the Internet (Bitbucket) that are not on the colleagueโ€™s computer, where I cloned from
+7
git
source share
2 answers

This is not a direct answer, but too large for comment. I just tried to reproduce your situation, and it works as expected for me (without downloading from the bitpack to the pull).

Some possible reasons why this does not work for you:

1) Check the colleagues repository - does it have the correct remotes setting? I'm not sure, but git probably uses remotes metadata to understand the relationships between repositories (just a hunch)

2) Maybe the repository of colleagues is not updated with a bitbucket? So when you do this, it just loads the new data. Try updating your peers repository first.

Here is the shell script I used to test the problem, you can play around with something like this to find out what causes the behavior you see:

 # Change this to your repository url BITBUCKET_URL=git@bitbucket.org :user/project git clone $BITBUCKET_URL project # Cloning into 'project'... # Warning: Permanently added the RSA host key for IP address 'xxx.xxx.xxx.xxx' to the list of known hosts. # remote: Counting objects: 163, done. # remote: Compressing objects: 100% (154/154), done. # remote: Total 163 (delta 53), reused 0 (delta 0) # Receiving objects: 100% (163/163), 3.62 MiB | 1.30 MiB/s, done. # Resolving deltas: 100% (53/53), done. # Checking connectivity... done. mkdir mycopy cd mycopy git clone ../project . # Cloning into '.'... # done. ls # application.py database.py README.md requirements.txt static git remote -v show # origin /home/seb/test/gitdist/mycopy/../project (fetch) # origin /home/seb/test/gitdist/mycopy/../project (push) git remote rename origin local git remote add origin $BITBUCKET_URL git remote -v show # local /home/seb/test/gitdist/mycopy/../project (fetch) # local /home/seb/test/gitdist/mycopy/../project (push) # origin git@bitbucket.org :owner/project.git (fetch) # origin git@bitbucket.org :owner/project.git (push) git pull origin # Warning: Permanently added the RSA host key for IP address 'xxx.xxx.xxx.xxx' to the list of known hosts. # From bitbucket.org:owner/project # * [new branch] 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. 

The output for each command is included above, you can see that the initial repository download was downloaded to the project folder (this emulates the colleagues repository), and then there is no download in the local repository when renaming the source, add a new origin as the bitbucket and go git pull origin URL git pull origin .

Update: check with two versions of git

As mentioned in the comments to another answer, there are two versions of git - git 1.9.4 on a peers computer and git 2.1.4 locally. I also have 2.1.4 locally, so I additionally get version 1.9.4 as follows:

 git clone git://git.kernel.org/pub/scm/git/git.git git checkout v1.9.4 make configure ./configure --prefix=/usr make all ./git --version # git version 1.9.4 

Now I modified the test script as follows:

 # Change this to your repository url BITBUCKET_URL=git@bitbucket.org :bosonz/gameofdata.git GIT194=./git/git $GIT194 --version $GIT194 clone $BITBUCKET_URL project # Cloning into 'project'... # .... # (the rest is unchanged) 

Result - there are still no problems, downloading from bitbucket is performed only once.

+3
source share

I believe that rename modifies the refs stored for this branch in the file system, so something can be changed that prevents it from binding objects without loading.

Perhaps you can get around this by temporarily pointing origin back to your colleague's reputation, allowing him to restore the data he needs and then again indicate the origin in the bitpack. First

git remote set-url him:/home/foo/repo

then git pull origin master , we hope, will reload the same 1535 objects on the local network. If so, you can use set-url again to point it to the bitpack

git remote set-rul <bitbucket-url>

and at that point git should have all the necessary objects, because only the remote url will be changed, so git pull should give already up-to-date .

+1
source share

All Articles