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

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.

Related

using find utility to look for all .git/config files under a certain directory

I have a certain github repo that I used to test out netlify and vuepress. I somewhat lost track of where it is on the file system, so I was planning to use mdfind (I am on mac) or find to locate all the .git/config files and then grep for my github url.
But it seems surprisingly hard to convince find to look for config under the hidden .git directories.
I did find How do I search all hidden files that are in hidden folders using Terminal? and looking at it, it looks like the following would work:
find . -name '.*' \( -type d -exec find {} \; -prune -o -print \) | egrep '/.git/config'
but given that config is a highly specific file for git, I was hoping that there is a better suited find command that will do the trick. I have already given up on mdfind as it the linked question's accepted answer is skeptical about getting it to reliably find hidden files.
Note: not looking for answers based on the locate utility, or some GUI tool, this is strictly about getting find to do the work.
Use -path.
find . -path '*/.git/config'

macOS find command behaving strangely

Example of command as used in bash script:
find '/Files' -type d -name temp* -depth -delete -print
This command should delete all folders, whose names start with "temp" in '/Files' folder and its subfolders ("temp0", "temp1", "temp2" etc.).
Script is working as expected, folders are found and properly deleted.
But sometimes, for some users, on some computers etc. script is not working as expected, despite the fact that folders & files are exactly the same.
Find command fails like this:
find /Files -type d -name tempta temptal -depth -delete -print
find: temptal: unknown primary or operator
I can't find out where "tempta" and "temptal" are coming - i don't have files with that names anywhere in the folder. Temp* folders are present, but not deleted because of this error.
The only thing which might be connected, are two files named "AbcInstall.sh" and "AbcInstall.log" in "AbcTemp" subfolder. So we have "ta" and "tal" plus "Temp". These are elements which reminds on "tempta" and "temptal", but they make no real sense - it could be a coincidence.
How can "find" result resolve into something like this !?!
Sorry for the lack of better explanation - this problem is really weird. The problem is that i can't replicate this issue on my computer so all i can do is experimenting (so far without success).
Any hints or ideas are greatly appreciated.
Thx!

Find git repository on macOS

I would like to find the location of a Git repository I made on my mac. Is there a way to find, for exemple, albatrocity/git-version-control.markdown on macOS using the Terminal? I installed everything with default parameters. I guess it must be in the User directory but I don't find anything related to GitHub there.
When I find it, I would like to completely remove it to maker a "proper" install.
EDIT: sudo find / -name "parsing.py" -print
I used a file that I know the folder contained when Terminal showed me nothing with sudo find / -wholename "*albatrocity/git-version-control.markdown"
You can use find's -wholename option to find a file based on its name and folder:
find <directory> -wholename "*albatrocity/git-version-control.markdown"
Example, if you want to search in the /Users/ directory:
find /Users/ -wholename "*albatrocity/git-version-control.markdown"
If you have locate on mac, and a regularly running updatedb, locate might be much faster:
locate albatrocity | grep git-version-control.markdown
It uses a hashtable to fast access filenames, but can be out of date, if the database isn't updated regularly or the file is too young (typically less than one day old).
If this is without success, then I would go for a full search with find, but maybe restrict it to a possible, narrowed path.

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.

XCode 4 - Snapshot Error - .gitignore ignores .DS_Store

**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.

Resources