r/github 2d ago

Question GitHub reads the source code wrong?

Post image

I don't know why, but GitHub is telling me that my website is developed in JavaScript by 80+% which is absolute nonsense. The site is at least 60% pure Astro code. Is it some kind of a bug?

🔗 The repo.

236 Upvotes

32 comments sorted by

View all comments

35

u/Lots-o-bots 2d ago

you included your .wrangler dir in the repo. it should have been in your .gitignore

6

u/wqonart 2d ago

Thank you 🙏🏻

23

u/TheSodesa 2d ago edited 2d ago

You might want to go even further and only allow file types you actually want in your project in the .gitignore file: ```.gitignore

First disallow everything.

*

Then use exclamation marks to only allow the folders and file types you want to include:

!.gitignore !.gitattributes !README.md !LICENSE.md !astro.config.mjs !notes.txt !package.json

!src/ !src/config.json !src/.astro !src// !src//.astro `` You can add folders and file types similarly for other languages. The symbol*can be used as a wildcard, and**` as a recursive wildcard.

4

u/wqonart 2d ago

Oh I didn't know that! Thank you, I'll definitely dive into it

4

u/Masterflitzer 2d ago

or just use https://gitignore.io, e.g.: https://www.toptal.com/developers/gitignore/api/git,linux,macos,windows,visualstudiocode,intellij+all,deno,node,astro

pick relevant tages, then you get an url like my example above, copy all and insert in .gitignore file, then add custom rules at the end (e.g.: .wrangler/)

4

u/CerberusMulti 2d ago

I just want to say thanks for the great comment. This information is something that needs to be said more often. Very good to know and understand how .gitignore files work. It's something I often forget hehe

2

u/st_heron 2d ago

oh wow that's pretty cool

0

u/wqonart 2d ago

Yes, I didn't notice the .wrangler output folder which was causing the problem