# Connect Custom Card UI to GitHub

**URL:** <https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464>\
**Category:** CMS Development\
**Tags:** enterprise\
**Created:** [April 8, 2025, 7:24am UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464 "2025-04-08T07:24:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pietro-Poli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pietro-poli/32/76836_2.png) [@Pietro-Poli](https://community.hubspot.com/u/Pietro-Poli)\
**Post date:** [April 8, 2025, 7:24am UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/1 "2025-04-08T07:24:09Z")

</div>

Hi! I’m working on migrate my custom cards in GitHub.

But when I connect to my HubSpot deploying falls with this error

```lia-code-sample
Directory /app/.vite has multiple validation errors. 
Directory .vite contains an invalid character: "vite". Remove it and try again.

```

So I’ve changed .gitignore file to avoid this kind of files and then I got this error

```lia-code-sample
Directory /app/app.functions/node_modules/.bin has multiple validation errors.

Directory .bin contains an invalid character: "bin". Remove it and try again.

```

Which files and folders I’ve not to push in my GitHub?

Thanks

---

<div class="post-metadata">

**Author:** ![MichaelMa](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MichaelMa](https://community.hubspot.com/u/MichaelMa)\
**Post date:** [April 8, 2025, 12:53pm UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/2 "2025-04-08T12:53:56Z")

</div>

Have you looked at the boiler plate CMS theme from Hubspot? I usually just copy their .gitignore file as a starting point and then add my own stuff:

> <https://github.com/HubSpot/cms-theme-boilerplate/blob/main/.gitignore>

node\_modules folder usually isn’t repo’d and you can see it’s ignored in the hubspot boilerplate theme.

---

<div class="post-metadata">

**Author:** ![Pietro-Poli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pietro-poli/32/76836_2.png) [@Pietro-Poli](https://community.hubspot.com/u/Pietro-Poli)\
**Post date:** [April 8, 2025, 2:25pm UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/3 "2025-04-08T14:25:01Z")

</div>

Thanks @MichaelMa I’ll try

---

<div class="post-metadata">

**Author:** ![nickdeckerdevs1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nickdeckerdevs1/32/5198_2.png) [@nickdeckerdevs1](https://community.hubspot.com/u/nickdeckerdevs1)\
**Post date:** [April 8, 2025, 6:09pm UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/4 "2025-04-08T18:09:39Z")

</div>

This is for a custom UI Extension -- it doesn’t use the CMS, it uses projects or github. The project is quite different, but I guess you could start wiht that .gitignore

---

<div class="post-metadata">

**Author:** ![Pietro-Poli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pietro-poli/32/76836_2.png) [@Pietro-Poli](https://community.hubspot.com/u/Pietro-Poli)\
**Post date:** [April 8, 2025, 2:51pm UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/5 "2025-04-08T14:51:02Z")

</div>

I’ve done using .gitignore files taken from boilerplate but now error is

```lia-code-sample
Directory /app/app.functions/node_modules/.bin has multiple validation errors.

Directory .bin contains an invalid character: "bin". Remove it and try again.

```

---

<div class="post-metadata">

**Author:** ![Pietro-Poli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pietro-poli/32/76836_2.png) [@Pietro-Poli](https://community.hubspot.com/u/Pietro-Poli)\
**Post date:** [April 8, 2025, 3:02pm UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/6 "2025-04-08T15:02:32Z")

</div>

```lia-code-sample
# HubSpot problematic directories
.vite/
**/.*/
**/*.tmp
dist/
.temp/
tmp/

# Specificatamente problematici per HubSpot
**/node_modules/.bin/
**/node_modules/.cache/

```

Maybe I’ve resolved by adding also these

---

<div class="post-metadata">

**Author:** ![nickdeckerdevs1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nickdeckerdevs1/32/5198_2.png) [@nickdeckerdevs1](https://community.hubspot.com/u/nickdeckerdevs1)\
**Post date:** [April 8, 2025, 6:13pm UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/7 "2025-04-08T18:13:18Z")

</div>

Use this -- you should be ignoring all your node module folders…

> <https://gist.github.com/NickDeckerDevs/e163f21e38bca2ebbac38cfa365bd234>

---

<div class="post-metadata">

**Author:** ![Pietro-Poli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/pietro-poli/32/76836_2.png) [@Pietro-Poli](https://community.hubspot.com/u/Pietro-Poli)\
**Post date:** [April 9, 2025, 5:06am UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/8 "2025-04-09T05:06:38Z")

</div>

Here how I’ve resolved for future purposes

### What to Exclude from Git (and HubSpot)

In most Node or front-end projects, a number of folders and files shouldn’t be pushed to your HubSpot portal. They can still be in your GitHub repository if you want to track them, but they generally must be ignored or excluded from upload to HubSpot:

1. **Build and Development Artifacts**  
• The “.vite” folder or any local cache folders created by your build tools  
• “dist”, “build” or any other production output directories
2. **node\_modules and Third-Party Files**  
• “node\_modules” typically contains thousands of dependencies that HubSpot doesn’t need  
• “.bin” within node\_modules is automatically generated, so it causes validation conflicts
3. **Configuration, Environment, and Local Files**  
• .env or .env.\* files containing environment variables  
• Local cache or lock files (like package-lock.json or yarn.lock) — it’s optional to keep them in GitHub for versioning, but they’re not needed on HubSpot’s side

### How to Implement These Exclusions

1. In your project’s **.gitignore** file, ensure you list the directories and files you do not want stored in the repository or sent to HubSpot. For example:

`.gitignore# Ignore build outputsdist/build/.vite/# Ignore dependenciesnode_modules/node_modules/.bin/# Ignore environment files.env.env.*`

1. If you’re using the HubSpot CLI, you can also define a **.hsignore** file to prevent these directories from uploading to your HubSpot account.

---

<div class="post-metadata">

**Author:** ![nickdeckerdevs1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nickdeckerdevs1/32/5198_2.png) [@nickdeckerdevs1](https://community.hubspot.com/u/nickdeckerdevs1)\
**Post date:** [April 9, 2025, 9:18pm UTC](https://community.hubspot.com/t/connect-custom-card-ui-to-github/129464/9 "2025-04-09T21:18:15Z")

</div>

I’m going to ignore the fact that you answered your own question with chat gpt and didn’t take the time to fix the code block so that it displays properly, but I’m going to address the issues I have with the response as a whole, regardless of who wrote it. So let me explain one major item that I think others would benefit from in the community when they are looking for a HubSpot UI Extension project .gitignore file in the future  
The reason this issue can happen is because of the ways these projects are set up -- there could be two sets of node\_modules folders in your repo (example: one for loading axios into your serverless functions, and then one for loading the UI Extensions into your extensions. See code block below.

```lia-code-sample
# this covers the root folder
node_modules/

# this covers any node_modules folder in your repo
**/node_modules/

```

That could have been an issue some have seen.  
Now, the code block you answered with is below, formatted so that the community can benefit from being able to read it… Now my issue with this answer -- having node\_modules/.bin/ is unnecessary because on the line before this, you already have ignored the node\_modules/ folder, which ignores all of the contents inside that folder and all other folders. We don’t build out individual lines for each node package to our .gitignore -- that would take forever to do that manually with the amount of modules that are depenedent upon other modules.

```lia-code-sample
# Ignore build outputs
dist/
build/
.vite/

# Ignore dependencies
node_modules/
node_modules/.bin/

# Ignore environment files
.env
.env.*

```

I tried to think about why you would need the second line, and I just can’t determine the need. If someone had added a file in the node\_modules/.bin/ file to the repo, adding this to the .gitignore wouldn’t untrack it, that would have to be done through other means to untrack the file.  
So, because I’ve already gone to this length to attempt to set the record straight, I’ll also not use a commonly used .gitignore file that is out there -- instead I’ve gone through a bunch of my projects I’ve done and have included this. First we’ll get into a small variance that you had mentioned, the .hsignore file, then my overly verbose .gitignore file I spent the past half day on.  
HubSpot [automatically ignores these files in the .hsignore](https://developers.hubspot.com/docs/guides/cms/tools/hubspot-cli/cli-v7#ignore-files) when you are using the hs upload

```lia-code-sample
hubspot.config.yml/hubspot.config.yaml
node_modules - dependencies
.* - hidden files/folders
*.log - NPM error log
*.swp - Swap file for Vim state
Icon\\r - Mac OS custom Finder icon
__MACOSX - Mac resource fork
~ Linux Backup file
Thumbs.db - Windows image file cache
ehthumbs.db - Windows folder config file
Desktop.ini - Windows custom folder attribute information
@eaDir - Windows Synology diskstation "hidden" folder where the server stores thumbnails.

```

If you have your project using github to deploy/build, then you should likely set these up as well in the project .gitignore file!  
So here is the [.gitignore, I also have a link here to it as a gist on github](https://gist.github.com/NickDeckerDevs/39376ff418c7bb105640f1f4a3d9484e)  
I will also include it in a code block below. I have added the comments into the file so I can talk about the who what and why of what is going on here so that people have a better understanding of the actual reason for these.

```lia-code-sample
# depending on how you set up your project, having the ** here will make sure
# to cover your entire project
**/node_modules/

# HubSpot config file
**/hubspot.config.yml
**/hubspot.config.yaml

# this is a file that keeps the packages in your project in sync
# if you want to make sure everyone is using the same version of packages it is a
# good idea to commit these files and not ignore them. It is also helpful when
# you are working with newer developers -- this makes it so anyone sharing this
# repo will be in sync with all packages, prevents issues with different package
# versions that could have different syntax, bugs, deprecations, etc.
**/package-lock.json

# env variables as you may use these, I have the !.env.example after the .env files
# so that you can create a .env.example file and commit it to the repo
# this allows you to share what your teams .env vars should be set up like
.env
.env.*
!.env.example

# build and log stuff, depending on what you do, you may not need the log stuff
target/
dist/
.vite/
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# operating system files that can get created in folders 
.DS_Store
Icon?
__MACOSX/
Thumbs.db
ehthumbs.db
Desktop.ini
@eaDir/
*~
*.swp

# for hidden files I don't like to ignore all of them wiht a *.
# If you aren't sharing setup with others, then you can just uncomment them
# if you want to share them in your repo
# then we have teh ! which allows you to override a previous rule

# vscode/cursor or any other branched forked editor
# the first two lines ignores all the vscode / code editor stuff
# the lines under that are allowing specific files to be shared in the repo
# *.code-workspace
# .vscode/* 
# !.vscode/settings.json
# !.vscode/tasks.json
# !.vscode/launch.json
# !.vscode/extensions.json

# cache files for linters and formatters that are commonly used
.eslintcache
.prettiercache
.stylelintcache
.history/

# as a last tidbit to add here -- If you are using webpack to extend your project
# so you can use other dependeices that HubSpot does not allow you should see:
# https://docs.google.com/document/d/e/2PACX-1vRGX60V2wQ2Co9X1NO73hkLObcQdNWp2i49XE-pY_DRS6UjZnv4UuODz4nsI_g1gUIXFC1MhN4AFsnZ/pub
# https://github.com/HubSpot/cms-webpack-serverless-boilerplate?tab=readme-ov-file
# **/dist/
# /coverage/
# config.json
# /.pnp
# .pnp.js
# /build/
# /public/
# /out/
# *.bundle.js
# *.bundle.js.map

```

Chat Gpt and other AI solutions are far from understanding everything about HubSpot development. They get the answer wrong all the time. There isn’t a massive amount of places that it can find these answers, and a lot of times it makes mistakes. I make a lot of mistakes to -- but I also think copy and pasting an answer from chat gpt should be noted “I used chat gpt to get this”
