In my gitignore file i have tried some many ways of ignoring the node_modules folder
.gitignore - file
./node_modules
/node_modules
node_modules
project structure
node_modules
public
src
.gitignore
In cases where /node_modules in your .gitignore file doesn't work, I suggest this:
git rm -r --cached node_modules
enter the above command before you git push to your repositories
Related
I have a problem with the .gitignore file in my Multiplayer Unity game project (consists of a game server and a client project in a single repository). The .gitignore file ignores most of the files, but not the binary files from the library artifacts.
Image of binary files showing in Github Desktop.
I know the .gitignore file works because if I remove it there is 30000 changed files and 8000 without removing it.
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.aab
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
Image of the repository folder with the 2 projects
hehe i think your answer is on the first line of the .gitignore
This .gitignore file should be placed at the root of your Unity project directory
All of those ignore paths without a preceeding / are only relative to the location of the .gitignore. It works like so:
Will ignore:
./Build/myBinary
Will not ignore:
./project1/Build/myBinary
./project2/Build/myBinary
Simplest solution is to duplicate your .gitignore and place one of each at the root of each project directory, not the repo directory.
Your directory should look like this:
myRepo
project1
.gitignore
Assets
...
project2
.gitignore
Assets
...
As mentioned, if files in these directories have already been committed they will need to be removed manually.
To be sure, assuming there are only binaries in this folders, try and delete them (from the Git index only, not from your disk), and check immediately (no commit needed) if your .gitignore applies.
cd /path/to/repo
git rm -r --cached path/to/folder/with/binaries/ # note the trailing slash
git check-ignore -v path/to/folder/with/binaries/aBinary # must be a file
If the last command does not return anything, then no .gitignore rule applies.
I am trying to deploy my site to Netlify, when I try to trigger deployment, I am getting this error:
1:46:02 PM: Error checking out submodules: fatal: No url found for submodule path 'startbootstrap-grayscale' in .gitmodules
1:46:02 PM: Failing build: Failed to prepare repo
1:46:02 PM: failed during stage 'preparing repo': Error checking out submodules: fatal: No url found for submodule path 'startbootstrap-grayscale' in .gitmodules
My Folder directory is the one I want to deploy and these are the contents within that directory.
LICENSE node_modules
README.md package-lock.json
css package.json
gulpfile.js scss
img startbootstrap-grayscale
index.html vendor
js
As you can see, the error is pointing to the startbootstrap-grayscale directory.
Within that startbootstrap-grayscale directory, everything you see above is within that same directory. (Not sure what I did there to have that happen). If I cd into the 2nd startbootstrap-grayscale directory, there is nothing inside of it.
I was told that I need to git submodule add <my github name> but am not sure what else to add in order to resolve this issue.
git submodule add -f asks for more info:
usage: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: git submodule [--quiet] init [--] [<path>...]
or: git submodule [--quiet] deinit [-f|--force] (--all| [--] <path>...)
or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference <repository>] [--recursive] [--] [<path>...]
or: git submodule [--quiet] summary [--cached|--files] [--su mmary-limit <n>] [commit] [--] [<path>...]
or: git submodule [--quiet] foreach [--recursive] <command>
or: git submodule [--quiet] sync [--recursive] [--] [<path>...]
or: git submodule [--quiet] absorbgitdirs [--] [<path>...]
Any suggestions as to what to add in order to fix this issue? Appreciate any help.
I've had a similar issue in different projects a few times before. My solution was usually to decouple the submodule and move the code into my codebase (or using a managed package for this).
To decouple the module go into your submodule folder, delete the .git folder and add the files to your git repository. On the command line I would do it like this:
// going into the submodule - might need to tweaked, depending on the exact path
cd startbootstrap-grayscale
// delete the git submodule
rm -rf .git
// going out of the directory
cd ..
// adding everything to git
git add .
With these steps (and potentially minor tweaks to the paths) I've been able to resolve this issue for me.
I was able to figure it out, I needed to get rid of my startbootstrap-grayscale folder by using rm -r startbootstrap-grayscale and pushing the changes. I had too many nested folders of the same type for some reason.
Completely nuking my git directory and then starting over with a new git commit worked for me. Not ideal but I was trying to get rid of git submodules and it didn't work. Now my site is live! https://connorleech.info/
rm -rf .git
git init
git remote add origin YOUR_URL
git add .
git commit -m 'restart history'
git push origin master
I pushed my newly initialized Ionic Apps to GitHub using the common practice:
git add .
git commit -m ""
git push origin master
But after this I went to check my Ionic project, everything was there except www folder. Can anyone tell me what went wrong?
There is a file named .gitignore, which limits the content for git
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore
*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
.vscode/
npm-debug.log*
.idea/
.ionic/
.sourcemaps/
.sass-cache/
.tmp/
.versions/
coverage/
dist/
node_modules/
tmp/
temp/
platforms/
plugins/
plugins/android.json
plugins/ios.json
www/
$RECYCLE.BIN/
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate
you could edit the file(delete www/).
my directory structure is like this:
roo
|
node_modules
|
packages
|
project1
|
lib
node_modules
project2
|
build
node_modules
I want to exclude lib, build or node_modules no matter where they are in the directory structure.
Here is my .gitignore
# dependencies
node_modules
/node_modules/
# testing
/coverage
# production
/build
/lib
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.tern-port
packages/*/lib/*
packages/*/dist/*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log
packages/*/node_modules
packages/*/lib
packages/*/build
Two options:
Use an .ignore file, and add the following to skip lib and node_moduels (for example):
*node_modules/
*lib/
Use the command line option to ignore a directory, the "--ignore-dir." For example, if you want to ignore node_modules and lib, you'd use this:
ag --ignore-dir lib --ignore-dir node_modules value
Note: I tested this with your exact directory structure.
git status keeps on showing eclipse resources:
naaka#naaka-ux501:~/dev/workspaces/ebeans$ git status
On branch master
Your branch is up-to-date with 'watour/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: .gitignore~
modified: .metadata/.log
deleted: .metadata/.plugins/org.eclipse.core.resources/.projects/services/org.eclipse.jdt.core/state.dat
modified: modified: .metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps
modified: .metadata/.plugins/org.eclipse.m2e.core/nexus/05b0fe8524860bd73cbb07ef30fb34cc/segments.gen
modified: .metadata/.plugins/org.eclipse.m2e.core/nexus/830bc118332e77292949ed1e6d2fabe0/segments.gen
modified: .metadata/.plugins/org.eclipse.m2e.core/nexus/fded8792ea35992e87221e67a8dea03d/segments.gen
modified: .metadata/version.ini
i tried several versions of gitignore:
/target/
/log/
**/.project
**/.classpath
**/.metadata
**/.settings
**/.recommenders
/.project
/.classpath
/.metadata
/.settings
/.recommenders
/.gitignore~
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
I also tried removing cached data and committing
git rm --cached .metadata
but they keep coming back!
You have already added .metadata folder to version control that's why it says modified
modified: .metadata/.log
you need to remove it from version control (git) and then add it to .gitignore
rm -rf .metadata
git add .
git commit -m "Remove .metadata from version control"
Then add .metadata to .gitignore
# gitignore
.metadata/
You have to clear the cache of .gitignore file too. Try with
git rm --cached .gitignore