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
{{ message }}
Repository navigation
SSH doesn't work with remotes not named 'origin' #2710
Setup your SSH key with GitHub and install Git LFS.
This step can be skipped if you're willing to use my repository for testing.
The repository needs to include a file tracked with Git LFS in a branch other than master. This file must not exist on master (this is to ensure a fresh download not from the local cache).
Steps
Copy/pasteable example at the bottom
Clone the repository with SSH git clone [email protected]:Org_Name/Repo_Name.git
Change directory into the clones repository. cd Repo_Name
Rename the remote to anything by origin. git remote rename origin remote_name
Checkout the to the branch with the large file. git checkout remote_name/branch_name --
The outcome should be the same as if you ran the steps without step 3.
E.g.
git clone [email protected]:rrama/Test.git
cd Test/
git checkout origin/large_file_0 --
Side effect of the error
The failure occurs after the regular (non-Git LFS tracked) files have been "checked out" (placed in the working directory), but before the branch has been switched. This means that you will still be on the branch you were on before running checkout, but with all the files (except those tracked by Git LFS) of the other branch. This is a nuisance and will require you to either manually correct the incorrect files or hope git reset --hard HEAD && git clean -fdq doesn't delete anything you didn't account for.
LFS uses Git's smudge filter to replace LFS pointers during git checkout. However, the context of which Git remote was used to pull info is not passed to LFS. So, the best LFS can do is go by the tracked branch. I just implemented that here: #2700
LFS will check the branch.{name}.remote property, which should be set automatically when you create a tracking branch. I'm not sure if there's any way to get this info from a command like git checkout origin/large_file_0 --. You may have to do something like this:
$ git clone [email protected]:rrama/Test.git
$ cd Test
$ git remote rename origin upstream
# This may take a bit since it's downloading the file in the bg
$ git checkout -t upstream/large_file_0
$ cat .git/config
[branch "master"]
remote = upstream
merge = refs/heads/master
[branch "large_file_0"]
remote = upstream
merge = refs/heads/large_file_0
If you like, I can provide a custom master build so you can try it out.
I was also getting this problem today and my scenario is that I was cloning a repository that contains LFS objects with command git clone -o<remote_name> <repo url>. The clone failed barking
I had to set lfs.url manually and the solution was only discovered after some hard research. The UX was horrible in this case, and I think there should be a fix.
In the case of initial cloning, it is obvious that there will be only one remote, and I think LFS could just look up the URL of the single remote and try to pull from. If it fails, at least the error message should suggest a fix (i.e. setting lfs.url).
Activity
technoweenie commentedon Nov 2, 2017
LFS uses Git's smudge filter to replace LFS pointers during git checkout. However, the context of which Git remote was used to pull info is not passed to LFS. So, the best LFS can do is go by the tracked branch. I just implemented that here: #2700
LFS will check the
branch.{name}.remoteproperty, which should be set automatically when you create a tracking branch. I'm not sure if there's any way to get this info from a command likegit checkout origin/large_file_0 --. You may have to do something like this:If you like, I can provide a custom master build so you can try it out.
haochenx commentedon Dec 10, 2017
I was also getting this problem today and my scenario is that I was cloning a repository that contains LFS objects with command
git clone -o<remote_name> <repo url>. The clone failed barkingI had to set
lfs.urlmanually and the solution was only discovered after some hard research. The UX was horrible in this case, and I think there should be a fix.In the case of initial cloning, it is obvious that there will be only one remote, and I think LFS could just look up the URL of the single remote and try to pull from. If it fails, at least the error message should suggest a fix (i.e. setting
lfs.url).fire commentedon Jan 16, 2018
this breaks git-repo. This means only one git-repo server (hosting n git repos) can have lfs.
For instance we can call github origin and put all the lfs repos there, but gitlab (called mine) will be unable to use git-lfs.
ttaylorr commentedon May 29, 2018
Moving to: #1053.