# Error 'git failed' when building on Win10

**URL:** <https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998>\
**Category:** Development\
**Created:** [January 4, 2023, 1:55am UTC](https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998 "2023-01-04T01:55:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ladon666](https://avatars.discourse-cdn.com/v4/letter/l/7ba0ec/32.png) [@Ladon666](https://forums.ankiweb.net/u/Ladon666)\
**Post date:** [January 4, 2023, 1:55am UTC](https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998/1 "2023-01-04T01:55:01Z")

</div>

Tried to run anki-2.1.55 from source on Windows, error message:

```
  Finished dev [unoptimized + debuginfo] target(s) in 2m 14s
thread 'main' panicked at 'git failed', build\runner\src\build.rs:154:5

```

I tried to follow the instructions under “Building from source”. I’m running Windows 10 Home Version 21H2, and Developer Mode is enabled.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [January 4, 2023, 10:29am UTC](https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998/2 "2023-01-04T10:29:00Z")

</div>

Did you install msys2, and git inside it?

---

<div class="post-metadata">

**Author:** ![Ladon666](https://avatars.discourse-cdn.com/v4/letter/l/7ba0ec/32.png) [@Ladon666](https://forums.ankiweb.net/u/Ladon666)\
**Post date:** [January 4, 2023, 9:50pm UTC](https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998/3 "2023-01-04T21:50:00Z")

</div>

MSYS2 was installed to `C:\msys64\`. `C:\msys64\usr\bin` was added to the path variable. The command `pacman -S git rsync` in MSYS2 returns `warning: git-2.39.0-1 is up to date` and `warning: rsync-3.2.7-1 is up to date`.

“Build Tools for Visual Studio 2019” was uninstalled, replaced with “Visual Studio 2022”.

* * *

By the way, I tried build bc6975973e and got the same error message.

In addition, `.\tools\runopt` no longer works on Windows, because the .bat file no longer exists in 2.1.55.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [January 5, 2023, 12:32am UTC](https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998/4 "2023-01-05T00:32:47Z")

</div>

Is there any text around the error message that may indicate the problem? If you look up the mentioned build.rs:154 you’ll see the command it invokes - what happens when you invoke it manually?

---

<div class="post-metadata">

**Author:** ![Ladon666](https://avatars.discourse-cdn.com/v4/letter/l/7ba0ec/32.png) [@Ladon666](https://forums.ankiweb.net/u/Ladon666)\
**Post date:** [January 5, 2023, 2:39am UTC](https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998/5 "2023-01-05T02:39:59Z")

</div>

Oops, I made a dumb mistake. I forgot to initialize the git repository in the project directory.

Thank you for your time. Anki 2.1.55 build successful.

* * *

PS: `.\tools\runopt.bat` doesn’t exist in 2.1.55, so Windows users have to set variables manually.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [January 5, 2023, 6:00am UTC](https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998/6 "2023-01-05T06:00:06Z")

</div>

Nobody’s got around to adding it yet - a PR would be welcome.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [February 4, 2023, 6:00am UTC](https://forums.ankiweb.net/t/error-git-failed-when-building-on-win10/25998/7 "2023-02-04T06:00:22Z")

</div>

Closed on February 4, 2023, 6:00am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
