# Unable to GenerateCustomBeat with Git Bash on Windows

**URL:** <https://discuss.elastic.co/t/unable-to-generatecustombeat-with-git-bash-on-windows/215974>\
**Category:** Beats\
**Created:** [January 22, 2020, 3:05am UTC](https://discuss.elastic.co/t/unable-to-generatecustombeat-with-git-bash-on-windows/215974 "2020-01-22T03:05:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mint-M](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@Mint-M](https://discuss.elastic.co/u/Mint-M)\
**Post date:** [January 22, 2020, 3:05am UTC](https://discuss.elastic.co/t/unable-to-generatecustombeat-with-git-bash-on-windows/215974/1 "2020-01-22T03:05:56Z")

</div>

I have followed all steps of the official guide bellow to generate a custom beat.  
[https://www.elastic.co/guide/en/beats/devguide/current/newbeat-generate.html#newbeat-generate](https://www.elastic.co/guide/en/beats/devguide/current/newbeat-generate.html#newbeat-generate)

It works on CentOS8 ,however I met a few problems on Windows.

Git 2.25.0 ,Python 2.7.17 ,go 1.13.5 and virtualenv 16.7.9 were installed on this Windows laptop.

I fixed the first problem of the wrong directory format myself by editing beats\generator\common\beatgen\setup\setup.go.

Line 100: "git archive --remote "+beatPath+" HEAD | tar -x --exclude=x-pack -C "+vendorPath) should be replaced with "git archive --remote '"+beatPath+"' HEAD | tar -x --exclude=x-pack -C "+vendorPath).

$ mage GenerateCustomBeat  
2020/01/22 10:10:04 Found Elastic Beats dir at D:\go\src\[github.com](http://github.com)\elastic\beats  
Enter the beat name [examplebeat]:  
Enter your github name [your-github-name]:  
Enter the beat path [[github.com/your-github-name/examplebeat](http://github.com/your-github-name/examplebeat)]:  
Enter your full name [Firstname Lastname]:  
Enter the beat type [beat]:  
fatal: sent error to the client: git upload-archive: archiver died with error  
remote: fatal: 'D:gosrcgithub.comelasticbeats' does not appear to be a git repository  
remote: git upload-archive: archiver died with error  
tar: This does not look like a tar archive  
tar: Exiting with failure status due to previous errors  
Error: error running git archive: running "sh -c git archive --remote D:\go\src\[github.com](http://github.com)\elastic\beats HEAD | tar -x --exclude=x-pack -C vendor\[github.com](http://github.com)\elastic\beats" failed with exit code 2

Nevertheless, it caused some loops after running 'mage GenerateCustomBeat' again.  
The output kept showing "Found Elastic Beats dir at C:\Users\beats\go\src\[github.com](http://github.com)\your-github-name\examplebeat\vendor\[github.com](http://github.com)\elastic\beats".  
Unfortunately, I didn't find any useful message which could help resolve this problem.  
It can also be reproduced on a fresh installed Windows computer.

beats@DESKTOP-T5E96U8 MINGW64 ~/go/src/github.com/elastic/beats (master)  
$ mage -debug GenerateCustomBeat  
DEBUG: 10:30:28.377736 getting all non-mage files in .  
DEBUG: 10:30:28.555476 found non-mage files  
DEBUG: 10:30:28.555476 getting all files plus mage files  
DEBUG: 10:30:28.886081 time to scan for Magefiles: 508.3452ms  
DEBUG: 10:30:28.886081 found magefiles: magefile.go  
DEBUG: 10:30:29.033354 output exe is C:\Users\beats\magefile\e3fea17945c6cebfb332d4aa149fcb540de3c7f3.exe  
DEBUG: 10:30:29.164922 go build cache exists, will ignore any compiled binary  
DEBUG: 10:30:29.164922 parsing files  
DEBUG: 10:30:29.166134 found target AddLicenseHeaders  
DEBUG: 10:30:29.166134 found target CheckLicenseHeaders  
DEBUG: 10:30:29.166134 found target DumpVariables  
DEBUG: 10:30:29.166134 found target Fmt  
DEBUG: 10:30:29.166134 found target GenerateCustomBeat  
DEBUG: 10:30:29.166134 found target PackageBeatDashboards  
DEBUG: 10:30:29.166134 time parse Magefiles: 1.1523ms  
DEBUG: 10:30:29.166241 Creating mainfile at mage\_output\_file.go  
DEBUG: 10:30:29.166442 writing new file at mage\_output\_file.go  
DEBUG: 10:30:29.169910 compiling to C:\Users\beats\magefile\e3fea17945c6cebfb332d4aa149fcb540de3c7f3.exe  
DEBUG: 10:30:29.169910 compiling using gocmd: go  
DEBUG: 10:30:29.517677 running go build -o C:\Users\beats\magefile\e3fea17945c6cebfb332d4aa149fcb540de3c7f3.exe magefile.go mage\_output\_file.go  
DEBUG: 10:30:30.660657 time to compile Magefile: 1.1290491s  
DEBUG: 10:30:30.660804 running binary C:\Users\beats\magefile\e3fea17945c6cebfb332d4aa149fcb540de3c7f3.exe  
DEBUG: 10:30:30.660804 running magefile with mage vars:  
MAGEFILE\_DEBUG=1  
MAGEFILE\_GOCMD=go  
2020/01/22 10:30:30 Found Elastic Beats dir at C:\Users\beats\go\src\[github.com](http://github.com)\elastic\beats  
Enter the beat name [examplebeat]:  
Enter your github name [your-github-name]:  
Enter the beat path [[github.com/your-github-name/examplebeat](http://github.com/your-github-name/examplebeat)]:  
Enter your full name [Firstname Lastname]:  
Enter the beat type [beat]:  
You have uncommited changes in elastic/beats. Running CopyVendor running in dev mode, elastic/beats will be copied into the vendor directory with cp  
DEBUG: 10:31:05.434840 getting all non-mage files in .  
DEBUG: 10:31:06.824772 found non-mage files main.go  
DEBUG: 10:31:06.824772 marked file as non-mage: "main.go"  
DEBUG: 10:31:06.824772 getting all files plus mage files  
DEBUG: 10:31:07.556151 time to scan for Magefiles: 2.1213114s  
DEBUG: 10:31:07.556151 found magefiles: magefile.go  
DEBUG: 10:31:07.708800 output exe is C:\Users\beats\magefile\7f339464e19330127d1e4d10c963fc90c91870d6.exe  
DEBUG: 10:31:07.858847 go build cache exists, will ignore any compiled binary  
DEBUG: 10:31:07.858847 parsing files  
DEBUG: 10:31:07.858847 found target Build  
DEBUG: 10:31:07.858847 found target BuildGoDaemon  
DEBUG: 10:31:07.858847 found target Check  
DEBUG: 10:31:07.858847 found target Clean  
DEBUG: 10:31:07.858847 found target Config  
DEBUG: 10:31:07.858847 found target CrossBuild  
DEBUG: 10:31:07.858847 found target Fields  
DEBUG: 10:31:07.858847 found target Fmt  
DEBUG: 10:31:07.858847 found target GolangCrossBuild  
DEBUG: 10:31:07.858847 found target Package  
DEBUG: 10:31:07.858847 found target Test  
DEBUG: 10:31:07.858847 found target Update  
DEBUG: 10:31:07.858847 found target VendorUpdate  
DEBUG: 10:31:07.858847 time parse Magefiles: 0s  
DEBUG: 10:31:07.858847 Creating mainfile at mage\_output\_file.go  
DEBUG: 10:31:07.859787 writing new file at mage\_output\_file.go  
DEBUG: 10:31:07.862983 compiling to C:\Users\beats\magefile\7f339464e19330127d1e4d10c963fc90c91870d6.exe  
DEBUG: 10:31:07.862983 compiling using gocmd: go  
DEBUG: 10:31:08.232689 running go build -o C:\Users\beats\magefile\7f339464e19330127d1e4d10c963fc90c91870d6.exe magefile.go mage\_output\_file.go  
DEBUG: 10:31:09.383308 time to compile Magefile: 1.1342371s  
DEBUG: 10:31:09.383640 running binary C:\Users\beats\magefile\7f339464e19330127d1e4d10c963fc90c91870d6.exe  
DEBUG: 10:31:09.383640 running magefile with mage vars:  
MAGEFILE\_DEBUG=1  
MAGEFILE\_GOCMD=go  
MAGEFILE\_DEBUG=1  
MAGEFILE\_GOCMD=go  
2020/01/22 10:31:09 Found Elastic Beats dir at C:\Users\beats\go\src\[github.com](http://github.com)\your-github-name\examplebeat\vendor\[github.com](http://github.com)\elastic\beats  
DEBUG: 10:31:09.849543 getting all non-mage files in .  
DEBUG: 10:31:10.568216 found non-mage files main.go  
DEBUG: 10:31:10.568216 marked file as non-mage: "main.go"  
DEBUG: 10:31:10.568216 getting all files plus mage files  
DEBUG: 10:31:11.293979 time to scan for Magefiles: 1.444436s  
DEBUG: 10:31:11.293979 found magefiles: magefile.go  
DEBUG: 10:31:11.461685 output exe is C:\Users\beats\magefile\7f339464e19330127d1e4d10c963fc90c91870d6.exe  
DEBUG: 10:31:11.615653 go build cache exists, will ignore any compiled binary  
DEBUG: 10:31:11.615653 parsing files  
DEBUG: 10:31:11.615653 found target Build  
DEBUG: 10:31:11.615653 found target BuildGoDaemon  
DEBUG: 10:31:11.615653 found target Check  
DEBUG: 10:31:11.615653 found target Clean  
DEBUG: 10:31:11.615653 found target Config  
DEBUG: 10:31:11.615653 found target CrossBuild  
DEBUG: 10:31:11.615653 found target Fields  
DEBUG: 10:31:11.615653 found target Fmt  
DEBUG: 10:31:11.615653 found target GolangCrossBuild  
DEBUG: 10:31:11.615653 found target Package  
DEBUG: 10:31:11.615653 found target Test  
DEBUG: 10:31:11.615653 found target Update  
DEBUG: 10:31:11.615653 found target VendorUpdate  
DEBUG: 10:31:11.615653 time parse Magefiles: 0s  
DEBUG: 10:31:11.615653 Creating mainfile at mage\_output\_file.go  
DEBUG: 10:31:11.616593 writing new file at mage\_output\_file.go  
DEBUG: 10:31:11.618614 compiling to C:\Users\beats\magefile\7f339464e19330127d1e4d10c963fc90c91870d6.exe  
DEBUG: 10:31:11.618614 compiling using gocmd: go  
DEBUG: 10:31:11.959351 running go build -o C:\Users\beats\magefile\7f339464e19330127d1e4d10c963fc90c91870d6.exe magefile.go mage\_output\_file.go  
DEBUG: 10:31:13.051396 time to compile Magefile: 1.0751484s  
DEBUG: 10:31:13.051396 running binary C:\Users\beats\magefile\7f339464e19330127d1e4d10c963fc90c91870d6.exe  
DEBUG: 10:31:13.051396 running magefile with mage vars:  
MAGEFILE\_DEBUG=1  
MAGEFILE\_GOCMD=go  
MAGEFILE\_DEBUG=1  
MAGEFILE\_GOCMD=go

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [January 23, 2020, 6:24pm UTC](https://discuss.elastic.co/t/unable-to-generatecustombeat-with-git-bash-on-windows/215974/2 "2020-01-23T18:24:29Z")

</div>

Hey @Mint-M, welcome to discuss 🙂

```auto
 remote: fatal: 'D:gosrcgithub.comelasticbeats' does not appear to be a git repository

```

This looks like a string where the backslashes are not being correctly escaped, it actually looks like a bug. Could you please open a [new issue](https://github.com/elastic/beats/issues/new?template=bug-report.md)?

Thanks!

---

<div class="post-metadata">

**Author:** ![111191](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111191/32/51649_2.png) [@111191](https://discuss.elastic.co/u/111191)\
**Post date:** [February 6, 2020, 4:25pm UTC](https://discuss.elastic.co/t/unable-to-generatecustombeat-with-git-bash-on-windows/215974/3 "2020-02-06T16:25:58Z")

</div>

Hi @jsoriano, we encountered the exact same issue.  
Is there a bug opened?  
In addition, is there a known work around we could use?

---

<div class="post-metadata">

**Author:** ![Mint-M](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@Mint-M](https://discuss.elastic.co/u/Mint-M)\
**Post date:** [February 24, 2020, 11:23am UTC](https://discuss.elastic.co/t/unable-to-generatecustombeat-with-git-bash-on-windows/215974/4 "2020-02-24T11:23:29Z")

</div>

> [@Mint-M](#):
>
> beats\generator\common\beatgen\setup\setup.go

Thanks for your reply.  
It can be fixed by editting 'beats\generator\common\beatgen\setup\setup.go' as I mentioned above. However,I was stucked at ' "Found Elastic Beats dir at C:\Users\beats\go\src[github.com]([http://github.com/](http://github.com/))\your-github-name\examplebeat\vendor[github.com]([http://github.com/](http://github.com/))\elastic\beats"' which kept showing after that fix.  
The documentation of beats doesn't mention whether it is officially supported to generate custom beats on Beats and I haven't seen successful examples of generating beats on windows.  
Is it possible for you to confirm if it can be reproduced by the elastic team and generating beats on windows will be supported?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 23, 2020, 1:23pm UTC](https://discuss.elastic.co/t/unable-to-generatecustombeat-with-git-bash-on-windows/215974/5 "2020-03-23T13:23:39Z")

</div>

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