Skip to content

lfs remote can't be renamed the "normal" way #1015

Closed

Description

@jroelofs

Pardon the <snip> censorship, this is from a private repo:

[15:15:21] ✔ jroelofs@galois build$ git remote rename origin github
[15:15:29] ✘ jroelofs@galois build$ git checkout <snip>
Downloading <snip> (28.13 MB)
Error accessing media: <snip> (274e002077deb9794db0d44e21a24f19c5e299feec24cb2c0b88b656e215c180)

Errors logged to .git/lfs/objects/logs/20160218T151550.808785338.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge %f failed 2
error: external filter git-lfs smudge %f failed
fatal: <snip>: smudge filter lfs failed
[15:15:50] ✘ jroelofs@galois build$ git lfs logs last
git-lfs/1.1.0 (GitHub; darwin amd64; go 1.5.1; git 258acf1)
git version 2.5.4 (Apple Git-61)

$ git-lfs smudge <snip>
Error accessing media: <snip> (274e002077deb9794db0d44e21a24f19c5e299feec24cb2c0b88b656e215c180)

Post objects/batch: unsupported protocol scheme ""
goroutine 1 [running]:
github.com/github/git-lfs/lfs.Stack(0x0, 0x0, 0x0)
    /Users/rick/go/src/github.com/github/git-lfs/lfs/errors.go:557 +0x80
github.com/github/git-lfs/commands.logPanicToWriter(0xd641c0, 0xc820030148, 0x8965c0, 0xc820010be0)
    /Users/rick/go/src/github.com/github/git-lfs/commands/commands.go:184 +0xf7f
github.com/github/git-lfs/commands.logPanic(0x8965c0, 0xc820010be0, 0x0, 0x0)
    /Users/rick/go/src/github.com/github/git-lfs/commands/commands.go:148 +0x421
github.com/github/git-lfs/commands.handlePanic(0x8965c0, 0xc820010be0, 0x0, 0x0)
    /Users/rick/go/src/github.com/github/git-lfs/commands/commands.go:123 +0x4e
github.com/github/git-lfs/commands.LoggedError(0x8965c0, 0xc820010be0, 0x55a620, 0x1e, 0xc820147c98, 0x2, 0x2)
    /Users/rick/go/src/github.com/github/git-lfs/commands/commands.go:73 +0x82
github.com/github/git-lfs/commands.smudgeCommand(0x75d060, 0xc820077990, 0x1, 0x1)
    /Users/rick/go/src/github.com/github/git-lfs/commands/command_smudge.go:77 +0xd89
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).execute(0x75d060, 0xc8200778e0, 0x1, 0x1, 0x0, 0x0)
    /Users/rick/go/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:477 +0x403
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).Execute(0x75e0a0, 0x0, 0x0)
    /Users/rick/go/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:551 +0x46a
github.com/github/git-lfs/commands.Run()
    /Users/rick/go/src/github.com/github/git-lfs/commands/commands.go:88 +0x23
main.main()
    /Users/rick/go/src/github.com/github/git-lfs/git-lfs.go:34 +0x12e

ENV:
LocalWorkingDir=.
LocalGitDir=.git
LocalGitStorageDir=.git
LocalMediaDir=.git/lfs/objects
TempDir=.git/lfs/tmp
ConcurrentTransfers=3
BatchTransfer=true
GIT_DIR=.git
GIT_WORK_TREE=.
GIT_PREFIX=build/

Workaround: clean up the partial checkout, and rename it back:

[15:16:27] ✔ jroelofs@galois build$ git remote rename github origin
[15:16:46] ✘ jroelofs@galois build$ git stash
Saved working directory and index state <snip>
gHEAD is now at 9783474 <snip>
[15:16:51] ✔ jroelofs@galois build$ git stash drop
Dropped refs/stash@{0} (fc5c926d8a7ed10115e0c5935c6c6ec412751308)
[15:16:56] ✔ jroelofs@galois build$ git checkout <snip>
Downloading <snip> (28.13 MB)

Activity

  1. technoweenie commented on Feb 19, 2016

    @technoweenie
    Contributor

    Is it because you have a git config value of remote.origin.lfsurl? Unfortunately, I'm not sure there's a lot we can do about renaming remotes other than adding a wrapper like git lfs rename-remote.

  2. jroelofs commented on Feb 19, 2016

    @jroelofs
    Author
    $ git config --list | grep remote\.origin\.lfsurl | wc -l
           0
    

    If git remote rename can't be made to DTRT, then... never mind, I guess.

    I'll volunteer to write the doc that explaining that renaming doesn't work if you point out the right place for that.

  3. technoweenie commented on Feb 19, 2016

    @technoweenie
    Contributor

    Ohhh, I know what's going on. This is an unfortunate side effect of how the clean/smudge filters work in Git. git checkout runs tracked files through git lfs smudge, which downloads the file from LFS and writes it to the working directory. The problem is that git checkout is completely separate from git fetch or git pull, so it has no idea what remote you're working in.

    I think you can do this by turning off the smudge filters with git lfs install --skip-smudge. This means that you will have to run git lfs pull <remote> to get the files from the correct git host. I thought Git LFS was able to detect a branch's tracking remote, but I guess not.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions