Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SOLVED: How can I get my local repo to ignore specific files in a remote repo?

wb-5697
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 16, 2019

I have some files that failed to checkout from a remote repo that I have cloned to my local repo.
This is because their names in the remote repo contain colons (I have no control over this). Windows does not allow file names to contain colons and so the checkout for those files fail with an 'Invalid argument' error.
Since they are not in my local repo but in the remote repo, sourcetree classifies the lack of files in my local repo as a change that I have made. It believes that I have deleted them.

The uncommitted changes (deleted files) are preventing me from other functions (such as other branch checkouts) and so I wish to discard these changes. 
However this does not work since to discard/reset the changes, the files need to be (re)created, which is not possible due to the naming issue mentioned previously.

I thought that instead I could prevent my sourcetree repo from viewing these files in the remote repo as files that need to be present. That way the lack of files in my local repo would not be seen as a change.
I cannot use the .gitignore file as I am not the only one using this remote repo.

Any help on this issue would be greatly appreciated.

1 answer

1 accepted

1 vote
Answer accepted
wb-5697
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 16, 2019

Figured it out:

Needed to add the files to my .git/info/exclude file and then remove them from my active changes using 

> git update-index --assume-unchanged <file>

Saw this from the following link:

https://docs.microsoft.com/en-us/azure/devops/repos/git/ignore-files?view=azure-devops&tabs=visual-studio

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events