How do I add a compiled application to the gitignore file? - github

I'm trying to upload my copy of Godot to my own github and it complains:
remote: error: File Godot.app/Contents/MacOS/Godot is 156.41 MB; this exceeds GitHub's file size limit of 100.00 MB
Ideally I dont want to upload this file at all.
I tried adding it to the .gitignore file.
I tried adding all kinds of different ways to type the path but none of them worked.
Heres the end of the file:
# Scons progress indicator
.scons_node_count
# ccls cache (https://github.com/MaskRay/ccls)
.ccls-cache/
# compile commands (https://clang.llvm.org/docs/JSONCompilationDatabase.html)
compile_commands.json
# Cppcheck
*.cppcheck
# https://clangd.llvm.org/ cache folder
.clangd/
.cache/
# The Godot app
/Godot.app

The pattern /Godot.app should match your file just fine. However, if the file is already added to the repository, then .gitignore has no effect on it. The .gitignore file affects only files which are untracked.
In your case, your file is in the history, and it needs to be removed from the entire history if you want to upload it to GitHub. You can do a git rebase -i to go back in history to the point at which it was added and remove it from history, or, if it was added in the most recent commit, you can remove it with git rm -r Godot.app and then run git commit --amend.
You could also use git filter-branch or git filter-repo to filter it out from the history.

Related

How can I stop cloning my application files on GitHub?

I want to stop cloning my application files to Github, How can I do that completely and remove the circle status on each solution files?
Environment: Visual Studio for Mac
Are you intending to have git ignore those files completely?
You can use a gitignore file (.gitignore) in the root working directory of your project to specify which files to ignore. In there, specify a filename per line in that file, or a whole directory to be ignored (eg: Shared/*).
You'll also need to remove those files from your git repo, since they've already been committed.
Copy-pasting from here:
Unstage the file
git reset HEAD newfile
Remove the file from git
git rm --cached newfile
Deleting the file will count as a commit, so you'll need to git push once you're done.
Also note that the file(s) and their contents will still exist in the git commit history, so this isn't a good idea if the goal is removing files with sensitive info.

How can I ignore any changes in a particular folder from Git

I want to exclude the changes in all files in a folder Api\Bin*.* and Core\obj*.* into GitHub merging. I dont want to consider that folder while merging the changes. How can I do that Please advise. I have added the following line of code in ignored file from Repository->Setting->Ignored files , but not working . When compile the program , still obj and bin folder files is showed in changes of GitHub
You can add a line in gitingore files following ways
logs/
These lines will ignore the logs folder. Even you can use patterns.
If those files are already tracked, no amount of .gitignore would work.
You need to remove them first (from the Git index, not from your disk)
git rm --cached -r API/bin/
git rm --cached -r Core/obj/
Then check (no commit needed) if you see them in GitHub Desktop.
You can also see if your .gitignore rules apply with:
git check-ignore -v -- Core/obj/<anObjFile>

SourceTree permanent local discard

I am new to Sourcetree and source control in general. I am working on an Android project with a few other people and use bitbucket as the repository. I have learned the basics but don't want to track certain files in my local, specifically a lot of the gradle and iml files. But i think Stop tracking will remove those from the repo. Is there a way to just have source tree ignore any changes i make to certain files locally but not delete them from the repo ?
Thank you in advance
You can create a file and name it .gitignore in the root of the project and in that file place every directory to exclude by git like:
my_folder
my_folder2
The above would be excluded from git tracked files.
If you are already tracking files this command will remove them from index:
git rm -r --cached <folder>

undo git add to remove staged files

I accidentally use git add . to add files to staging area and did a git push which got rejected because I have a large file. I want to undo git add . to unstage the files added. After some search I found git reset to reset the staged files. I also go to my work directory and delete that large file. This time I tried git add ./myfolder/myfile.py but still got rejected by remote saying that contains large files. remote: error: File myfolder/myfile.parquet is 374.75 MB; this exceeds GitHub's file size limit of 100.00 MB. This file was git add in the first time. It seems that git reset does not work. How to do this properly?

Hiding files that have been git rm --cached from the list of changed files in GitHub for Windows

In GitHub for Windows, files that have been git rm --cached still appear in the list of changed files. Is there any way to hide them?
You still need to add the files to your .gitignore file.
http://www.gitguys.com/how-to-remove-a-file-from-git-source-control-but-not-delete-it/:
The git rm command will allows you to remote a file from git control.
The –cached option to git remove allows you to leave it on your hard
drive.
Every once in awhile a file gets checked into git that isn’t supposed
to be there. Common examples are configuration files, project files
generated by your IDE with personal settings and even the occasional
object file that someone decided to check in. These files are needed,
so often you can’t delete them entirely and the process of copying
them somewhere else, removing them from git and then replacing is
painful, not to mention prone to error.
By adding the –cached option to the git rm command, you are able to
remote the file file from git control while keeping the file in your
working tree. They command syntax is:
git rm --cached file
Git will no longer track this file even though it is still on your
hard drive.
After running the above command, be sure to add an entry to your .gitignore file so that ‘file’ doesn’t show up in ‘git status’ and that it can’t accidentally be re-added later.