# Repository import failed for git repos

**URL:** <https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120>\
**Category:** SCM-Manager (General)\
**Created:** [April 4, 2023, 1:29pm UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120 "2023-04-04T13:29:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jochen](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/jochen/32/989_2.png) [@jochen](https://community.cloudogu.com/u/jochen)\
**Post date:** [April 4, 2023, 1:29pm UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/1 "2023-04-04T13:29:08Z")

</div>

In the past I’ve used to have gzipped git bundle files for backup. I’ve also used them importing into SCM-Manager. This seems to be somehow broken. When I’m trying to import a plain git bundle file without compression, I’ve got the following error:

> Import of repository git/smos  
> Repository type: git  
> Imported from: DUMP  
> Imported by chef (chef)
> 
> 2023-04-04T13:13:13.773241500Z - import started  
> 2023-04-04T13:13:13.786241200Z - writing temporary dump file  
> 2023-04-04T13:13:13.787240400Z - importing repository data from dump file  
> 2023-04-04T13:13:13.841238900Z - import failed (see next log entry)  
> Error detected parsing the header  
> 2023-04-04T13:13:13.989242700Z - import failed (see next log entry)  
> Failed to import from bundle

Anything I’m doing wrong? The bundle was created on Windows on a fresh cloned repository using the following statement:

> cd \< CLONED REPO DIRECTORY \>  
> git bundle create ./…/smos.bundle --all

SCM-Manager is running in Version 2.42.3 on Windows, too.

---

<div class="post-metadata">

**Author:** ![eheimbuch](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/eheimbuch/32/18_2.png) [@eheimbuch](https://community.cloudogu.com/u/eheimbuch)\
**Post date:** [April 5, 2023, 12:31pm UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/2 "2023-04-05T12:31:25Z")

</div>

Hey @jochen,

could you provide the full stacktrace? Which is the exact reason your bundle header could not be parsed.

I assume you double checked your import config? It should be Git, uncompressed, no password

 ![Screenshot from 2023-04-05 14-29-52](https://europe1.discourse-cdn.com/flex013/uploads/cloudogu2/original/2X/3/3914949866cba7b41b1a5dc6b6886426b98b18b8.png)

---

<div class="post-metadata">

**Author:** ![jochen](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/jochen/32/989_2.png) [@jochen](https://community.cloudogu.com/u/jochen)\
**Post date:** [April 5, 2023, 12:50pm UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/3 "2023-04-05T12:50:50Z")

</div>

Hej Eduard,

please find attached some screenshots. I’m not sure about the stack trace. I did the following:

- Shutdown the SCM-Manager on my testmachine
- Removed all files in the log directory
- Installed and startup the SCM-Manager
- Login and do the import as usual
- Logoff and shutdown
- Zip log directory

Hope this helps.

Regards

Jochen

PS: If it will help, I can install also the support plugin.

 ![01 Import-Settings](https://europe1.discourse-cdn.com/flex013/uploads/cloudogu2/original/2X/f/fbeeedaf7c03c3954c9ccd78b53d899f65ab53ba.png)  
 ![02 Import-Result](https://europe1.discourse-cdn.com/flex013/uploads/cloudogu2/original/2X/1/19fc2b8e1b80e3cc0a1d6c9937756fa1a44940bd.png)  
 ![03 Import-Protocol](https://europe1.discourse-cdn.com/flex013/uploads/cloudogu2/original/2X/2/20c8edc220f36731fb55ace99fd8ec421cca9ae0.png)  
[logs.zip](https://community.cloudogu.com/uploads/short-url/qjaGXRm03TMf5r6m992X5LTtAQL.zip) (9,5 KB)

---

<div class="post-metadata">

**Author:** ![eheimbuch](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/eheimbuch/32/18_2.png) [@eheimbuch](https://community.cloudogu.com/u/eheimbuch)\
**Post date:** [April 5, 2023, 1:07pm UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/4 "2023-04-05T13:07:05Z")

</div>

I reproduced your case and found this during the import:

```auto
Caused by: java.lang.IllegalArgumentException: Invalid byte 100 at offset 0 in 'd71ff953' len=8

```

Not sure what this is about but we will try to find a solution.

---

<div class="post-metadata">

**Author:** ![eheimbuch](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/eheimbuch/32/18_2.png) [@eheimbuch](https://community.cloudogu.com/u/eheimbuch)\
**Post date:** [April 5, 2023, 1:14pm UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/5 "2023-04-05T13:14:12Z")

</div>

Okay, our docs say that we don’t support git bundles yet. Our export format matches the expected import format.

```auto
The output format of the repository can be changed via the offered options:

Standard: If no options are selected, the repository will be exported in the standard format. Git and Mercurial are exported as Tar archive and Subversion uses the Dump format.

```

Source: [https://scm-manager.org/docs/2.42.x/en/user/repo/settings/](https://scm-manager.org/docs/2.42.x/en/user/repo/settings/)

Can you import the repository without git bundles? I think you can simply `tar` your bare repository. Feel free to export an example repository and check the expected format.

---

<div class="post-metadata">

**Author:** ![jochen](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/jochen/32/989_2.png) [@jochen](https://community.cloudogu.com/u/jochen)\
**Post date:** [April 5, 2023, 1:53pm UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/6 "2023-04-05T13:53:02Z")

</div>

Oh, okay, didn’t know this. I’ve developed backup scripts based on git bundle. Tested during development also the import to SCM-Manager. The backup and also the restore worked very well. Haven’t tested the restore since last year.

Thanks for your suggestions. I’ve tried the following cases:

- git clone --mirror, tar it =\> No success
- git clone --bare, tar it =\> No success

The message “Failed to import from bundle” makes me believing that a git bundle seems to be the right way, but I may be wrong.

I’ve installed the “Repository Mirror Plugin” and cloned a git repo from GitHub and exported it without metadata but zipped.

Then I was successful in importing this export. The result of unzipping/untaring the export confuses me - the result is readable, but at least for me an unknown format. Is there any kind of format description available?

---

<div class="post-metadata">

**Author:** ![eheimbuch](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/eheimbuch/32/18_2.png) [@eheimbuch](https://community.cloudogu.com/u/eheimbuch)\
**Post date:** [April 5, 2023, 6:21pm UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/7 "2023-04-05T18:21:45Z")

</div>

Unfortunately in this case the code is our documentation.

If you are interested here some pointers for research:

- The export gets called [here](https://github.com/scm-manager/scm-manager/blob/303f8daaf9c66742ffb6d3ab33518d183cbdf329/scm-webapp/src/main/java/sonia/scm/api/v2/resources/RepositoryExportResource.java#L491)
- The bundle logic for git is [here](https://github.com/scm-manager/scm-manager/blob/5f887d4fa8d11f471de981ec78f5e112d1863fcf/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitBundleCommand.java)
- The tar writer is [that](https://github.com/scm-manager/scm-manager/blob/5f887d4fa8d11f471de981ec78f5e112d1863fcf/scm-core/src/main/java/sonia/scm/util/Archives.java)

---

<div class="post-metadata">

**Author:** ![jochen](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/jochen/32/989_2.png) [@jochen](https://community.cloudogu.com/u/jochen)\
**Post date:** [May 12, 2023, 10:12am UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/8 "2023-05-12T10:12:56Z")

</div>

Hello @eheimbuch,

thank you for your support. I’ve tested an export created by the SCM-Manager - this one can be imported by the system without any problems.

Regards  
Jochen

---

<div class="post-metadata">

**Author:** ![christoph.loose](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/christoph.loose/32/1400_2.png) [@christoph.loose](https://community.cloudogu.com/u/christoph.loose)\
**Post date:** [June 12, 2023, 6:27am UTC](https://community.cloudogu.com/t/repository-import-failed-for-git-repos/1120/9 "2023-06-12T06:27:35Z")

</div>


