Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

where do i add git confg - - global core.excludesfile ~/.gitignore ?

 
Ranch Foreman
Posts: 986
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I am in need of help and I have been searching and asking around a few days to no avail.

So, there is this line :


that I discovered I need to create according to Stackoverflow and bitbucket tutorial :


define global Git ignore patterns for all repositories on your local system by setting the Git core.excludesFile property.



but it didn't say specific where cos I open up my .gitconfig file :

it shows me :


so the above line obviously didn't work cos when I put .classes/ inside git ignore, commited and pushed, those files still showed up in the repo.

I'd like to confirm do I remove that line above and replace it with




and this will resolve the problem of sending .classes/folder up to the repo whenever I push my code up to the repo ?

Tks.
 
Saloon Keeper
Posts: 14788
333
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The line that you quoted is not what you should put in the config file, it is a Git command that you use to edit the config from the command line. It's full of errors though.

Why are you messing with global ignores? A repository should instead have a .gitignore file where you specify the files you want to ignore at the repository level.

Note that if you've pushed files to your repository, you must first remove them before you can ignore them.
 
Sheriff
Posts: 22725
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I definitely agree with Stephan. If the repository contains a .gitignore, then everybody that clones the repository will use it. People will not accidentally commit files because they don't have the same git ignores.
 
Saloon Keeper
Posts: 26728
190
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the nice things about git is that any given project can have two kinds of "ignore" files.

The obvious one is .gitignore. You should use it to keep locally-produced project files out of the repository so that a "push" won't publish them to the master repository and clutter it up.  So .gitignore redlines things like the Maven target directory, backup file from editors and tools ("*.bak" and so forth), and other stuff of that nature.

But often I'll have local files that I don't want either git or .gitignore to know about. These are often to-do list files, scratchpad stuff, temporary data files and so forth. For that, there's another ignore file you can create inside the .git directory. That way you can include the .gitignore file as part of your archive set without polluting it with stuff that no one sharing the project should see.

The "~/.gitignore file" is yet another beastie. The "~" is Unix shorthand for your home directory, and thus it gets applied to ALL projects on your user account. The command that started this thread simply sets the user's git options globally to exclude that file. Or, in other words, to ignore $HOME/.gitignore.

 
tangara goh
Ranch Foreman
Posts: 986
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:The line that you quoted is not what you should put in the config file, it is a Git command that you use to edit the config from the command line. It's full of errors though.

Why are you messing with global ignores? A repository should instead have a .gitignore file where you specify the files you want to ignore at the repository level.

Note that if you've pushed files to your repository, you must first remove them before you can ignore them.



OK. Tks. I have since put the git ignore at the Users directory where the git config resides.

That git command is not be executed after the above step.

Another way I learnt is that I need to remove it as it is in the cache hence it get  pushed even though there is a git ignore in the local repo.
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic