How to keep Git files from being pushed to Bitbucket

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

This widget could not be displayed.

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.

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published 9 hours ago in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

39 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you