XCode 4 - Snapshot Error - .gitignore ignores .DS_Store - xcode

**Unable to create snapshot**
The following paths are ignored by one of your .gitignore files:
/path/to/project/.DS_Store
Use -f if you really want to add them
fatal: no files added
thats the error i get any ideas?!? google a lot all the snapshot problems didn't seem to fit on my error message

Delete the .DS_STORE ( they are not really needed, they store Finder releated meta data).
Use some command like:
sudo find /path/to/project -name ".DS_Store" -depth -exec rm {} \;

You can also remove .DS_STORE from your gitignore config (although it really should be ignored because you dont want this useless file in your repo) by removing it from the file at ~/.gitignore or /Users/YOU/.gitignore.

Related

How to add directory recursively on git safe.directory?

According to this QA, we may use safe.directory argument to add directory to be marked as whitelist, due to latest CVE found on git. But it seems there is no way to add certain dirs recursively.
I have so many repositories to add, so i want to use recursive add instead, if the feature is exist. The repositories mostly placed on my mounted NTFS disk on ubuntu, so the owner of files inside is always root. Looks like the latest update restricts git operations if the logged in user is not match with owner of the git directory by showing error such fatal: unsafe repository ('/media/data1/project1/si/project' is owned by someone else.
From Git 2.36, you can also add * representing 'all' to the safe.directory. It's not recursive as you asked, but it may help depending upon your situation i.e.
git config --global --add safe.directory *
See https://github.blog/2022-04-18-highlights-from-git-2-36/ and search for safe.directory.
What I did for now, but may not be the perfect solution, is to find all .git folders and add them through a find command.
find /full/path -name '.git' -type d -exec bash -c 'git config --global --add safe.directory ${0%/.git}' {} \;
Want to remind, that it is necessary to add the full path in the find command, so it will resolve the full path.

.gitignore files not working (ignore .DS_Store file in Mac OS)

I have create a.gitignore file at my ~ path by this code in my terminal:
touch ~/.gitignore
and also add this file and git defining excludes file by below code:
git config --global core.excludesfile ~/.gitignore
and then remove all of my .DS_Store file using below command
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
(every file has been removed successfully and if I open xCode and press commit the D label appears near this files)
Before I commit I add the .DS_Store to the .gitignore file by this command:
echo .DS_Store >> ~/.gitignore
it also works and write the value in the file but it is not working. Because when I back to xcode and commit the files and then back to finder and navigate to folders and back to xcode, I can see the .DS_Store files in commit dialog too.
Does someone have any idea about what is the problem?
After performing the
git rm
you still need to commit those changes
git commit -m "deleted all .DS files"
The next time you will ask git for a diff, these files will no longer show up as modified or "new" because they are in your global gitignore file

Delete unnecessary Iconr files from the Xcode commit

I need to remove these Iconr files from the project\commit but I cant find them in the project folder (even in the hidden files).
I can't perform any commit with these files, how can I remove them?
These files are created by some external apps such as Folderol which are used for highlighting/coloring your folders. Remove that app, or add these files into gitignore files, either to:
.gitignore inside your repository root,
global .gitignore, e.g.
git config --global core.excludesfile ~/.gitignore
into explicit repository exclude file (.git/info/exclude) inside your repository root.
See: Using Git / Ignoring files
To delete them, try:
find . -type f -name 'Icon??' -print -delete

'atal: Reference has invalid format: 'refs/Icon

I'm trying to upload a file to github and I keep getting this error when I type "git add ." or
"git commit -m 'message'" in command line (on mac os x 10.9). I am not sure what this means
'atal: Reference has invalid format: 'refs/Icon
Same problem I had with Google Drive. I simply deleted all the "Icon" files in my project folder, then, git works.
find . -name "Icon*" -type f -delete
In case you have a file named "Icon" something, use the command below will keep your own "Icon" file.
find . -type f \( -name "Icon*" ! -name "*.*" \) -delete
I had the same problem trying to push from Google Docs shared directory. When moved (and recreated) .git into local home, problem gone away.
The answer "Git fatal: Reference has invalid format: 'refs/heads/master'" mentions looking for "*conflicted*' files in .git
find .git -name '*conflicted*'
The OP confirms having done a similar operation.
The file I opened was in .git/refs/heads/ and had some weird text which didn't seem necessary
I would rather try and clone again the repo, report my modification (add, commit), and try to push again.
I downloaded a git repository from my Google Drive to a different computer and the folder icon looked as this one
And after running the following command mentioned by Yong (I've already upvoted)
find . -name "Icon*" -type f -delete
The icon of the folder became regular as follows
and problem got resolved. But this command can also delete some icons files being used on purpose so we need to get rid of the icon files being used for customising the folder/sub-folders icons. So a slightly modified command is as follows
find . -name Icon? -type f -delete
You can also change the google drive sharing option to OFF for all the folders - bit laborious but does remove the error as I just tried it.

How to remove all files with a specific extension from version control?

I am using Mercurial under Linux. I would like to exclude all files containing the pattern *.pro.user* from the version control system.
I tried to list all the files with:
find . -name "*.pro.user*"
This turned out also some results which are in the .hg folder:
...
./.hg/store/data/_test_run_multiple/_test_run_multiple.pro.user.i
./.hg/store/data/_test_non_dominated_sorting/_test_sorting.pro.user.i
./Analyzer/AlgorithmAnalyzer.pro.user
./Analyzer/AlgorithmAnalyzer.pro.user.a6874dd
...
I then tried to pipe this result to the hg forget command like:
find . -name "*.pro.user*" | hg forget
but I get:
abort: no files specified
My guess is that the list needs to be processed in some way in order to be passed to hg forget.
I would like to ask:
How can I pass the result of my find query into the hg forget command?
Since the query result contains files in the "private" folder .hg, is it a good idea? I hope that Mercurial will ignore that request, but shoud I remove those results somehow?
Try the following:
hg forget "set:**.pro.user*"
This tells Mercurial to forget any files that match the fileset **.pro.user*. As the fileset is defined in Mercurial, it won't go into the .hg directory. You can do even more with filesets by looking at: hg -v help filesets
The ** at the start means to work in subdirectories, rather than just the current directory.
First of all, you can use find * -name "*.pro.user*" to avoid looking in .hg.
Mercurial's forget command requires its arguments on the command line. So you need to use xargs:
find * -name "*.pro.user*" | xargs hg forget
Alternatively you can ask find to do the job:
find * -name "*.pro.user*" -exec hg forget {} \;
Finally, you should add *.pro.user* to your .hgignore file.

Resources