Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to keep Git files from being pushed to Bitbucket

George Lewe (LSY)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 10, 2013

I develop my local repo with Eclipse. The repo therefore contains files and directories created by Eclipse, e.g. .settings, .buildpath, .project and such. I do not want these folders and files to be pushed to Bitbucket. I added them to .gitignore and also to .git/info/exclude. I ran the git command:

git ls-files --others --exclude-from=.git/info/exclude

But whenever I recreate the Bitbucket repo, these are pushed up and I see them in the source list. How can I avoid that?

My .gitignore:

/.buildpath
/.settings
/.project
/.gitignore

My .git/info/exclude:

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
/.buildpath
/.settings
/.project
/.gitignore

2 answers

1 accepted

1 vote
Answer accepted
George Lewe (LSY)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 10, 2013

I found the reason and also fixed it. Problem was that there were previous commits for those objects because they were not always excluded. I reinitialized the repo locally, excluded those files and recreated the repo in Butbucket. That worked.

1 vote
Jason Alan Kennedy
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!
December 8, 2014

You can also use: `git update-index --assume-unchanged path/to/file.txt`

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events