bozaro / git-lfs-migrate

Simple project for convert old repository for using git-lfs feature
MIT License
222 stars 29 forks source link

LFS server: Invalid base URL when converting bit bucket repo #50

Closed BCITMike closed 4 years ago

BCITMike commented 4 years ago

I am trying to convert an existing 1.8GB Bit Bucket repo to another BB repo with LFS for all the binary files.

I am running the command:

$ java -jar git-lfs-migrate.jar \
>      -s source-repo.git \
>      -d destination-repo.git \
>      -g git@bitbucket.org:companyname/destination-repo.git \
>      "*.md" \
>      "*.jar" \
>      "*.PcbLib" \
>      "*.SchLib" \
>      "*.zip" \
>      "*.EDF" \
>      "*.PDF" \
>      "*.xls" \
>      "*.xlxs" \
>      "*.step" \
>      "*.docx" \
>      "*.exe" \
>      "*.bin" \
>      "*.jar" \
>      "*.war"

And I get the following error:

[main] INFO git.lfs.migrate.Main - LFS server: Batch API request exception
com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of java.net.URI from String value ("https://bitbucket.org/{}/{dc5f1f05-e4eb-430f-8d06-79bbdc00712f}/info/lfs"): not a valid textual representation, problem: Illegal character in path at index 22: https://bitbucket.org/{}/{dc5f1f05-e4eb-430f-8d06-79bbdc00712f}/info/lfs
 at [Source: [B@5ab9e72c; line: 1, column: 259] (through reference chain: ru.bozaro.gitlfs.common.data.Link["href"])
        at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:74)
        at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:923)
        at com.fasterxml.jackson.databind.deser.std.FromStringDeserializer.deserialize(FromStringDeserializer.java:136)
        at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeWithErrorWrapping(BeanDeserializer.java:465)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:380)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1123)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:298)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:133)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3788)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2872)
        at ru.bozaro.gitlfs.client.auth.ExternalAuthProvider.getAuthUncached(ExternalAuthProvider.java:84)
        at ru.bozaro.gitlfs.client.auth.CachedAuthProvider.getAuth(CachedAuthProvider.java:38)
        at ru.bozaro.gitlfs.client.Client.doWork(Client.java:248)
        at ru.bozaro.gitlfs.client.Client.postBatch(Client.java:118)
        at git.lfs.migrate.Main.checkLfsAuthenticate(Main.java:113)
        at git.lfs.migrate.Main.main(Main.java:66)
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 22: https://bitbucket.org/{}/{dc5f1f05-e4eb-430f-8d06-79bbdc00712f}/info/lfs
        at java.base/java.net.URI.create(URI.java:883)
        at com.fasterxml.jackson.databind.deser.std.FromStringDeserializer$Std._deserialize(FromStringDeserializer.java:214)
        at com.fasterxml.jackson.databind.deser.std.FromStringDeserializer.deserialize(FromStringDeserializer.java:122)
        ... 14 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 22: https://bitbucket.org/{}/{dc5f1f05-e4eb-430f-8d06-79bbdc00712f}/info/lfs
        at java.base/java.net.URI$Parser.fail(URI.java:2915)
        at java.base/java.net.URI$Parser.checkChars(URI.java:3086)
        at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3168)
        at java.base/java.net.URI$Parser.parse(URI.java:3116)
        at java.base/java.net.URI.<init>(URI.java:600)
        at java.base/java.net.URI.create(URI.java:881)
        ... 16 more
[main] ERROR git.lfs.migrate.Main - LFS server: Invalid base URL

If I run the migration command without the -g line, it will run without error. But when I push it and then try a checkout on another machine, I get tons of errors that objects are missing from server. So it sounds like I really need to figure out the -g line.

What is causing the LFS string to be empty (and filled with curly braces) and what do I need to do to get it returning a proper string that will work?

Thanks in advance!

BCITMike commented 4 years ago

Well, luckily, I was able to figure it out. The -g line needed to be changed to https format, then it worked.

-g https://username:password@bitbucket.org/company/destination_repo.git \