| Line 166: | Line 166: | 
|  |            You can now continue to code and push/pull to GitHub as needed to track/update changes. Good luck, if it doesn't work don't blame me ... I only work here :) </li><br> |  |            You can now continue to code and push/pull to GitHub as needed to track/update changes. Good luck, if it doesn't work don't blame me ... I only work here :) </li><br> | 
|  | </ol> |  | </ol> | 
|  | + |  | 
|  | + | == <i>Ignoring Files (.gitignore)</i> == | 
|  | + | There are various reasons to not want to track/push files. Here are some and how to handle them. | 
|  | + | <ol> | 
|  | + | <!-- Step 1 --> | 
|  | + | ===Case 1 === | 
|  | + | Case #1 - Trouble pushing files due to being too big (>50 MB, GitHub max) <br> | 
|  | + |   <li><u>Find those files</u>: <br> | 
|  | + |         - Ensure you're in the directory of interest (use <b>cd </b> command as needed) <br> | 
|  | + |         - Type <b>find . -type f -size +50M </b><br> | 
|  | + |         - This will list files that are above GitHub's 50 MB limit </li><br> | 
|  | + |  | 
|  | + |   <li><u>Create a .gitignore file</u>: <br> | 
|  | + |         - To create one use the command <b>touch .gitnore </b><br> | 
|  | + |           Make sure you are in the root folder of your repository on your local computer when you use this command <br> | 
|  | + |           Hint - The root folder is named the same as your repository on GitHub </li><br> | 
|  | + |  | 
|  | + |   <li><u>Use your favorite text editor to open the file (i.e. Vim, Notepad++, etc.)</u>: <br> | 
|  | + |         - Enter the oversized files from above into the girignore file<br> | 
|  | + |           Make sure to remove the . if you decide to copy/paste <br> | 
|  | + |       <i><u>Example</u>:</i></li> | 
|  | + |  | 
|  | + | <!-- Example --> | 
|  | + | <pre># Remember: A line that follows # is  a comment. | 
|  | + | # | 
|  | + | # To ignore a file update this file (.gitignore) then add, commit, and push this file. | 
|  | + | # Do this BEFORE any other pushes so the rule will be in effect. | 
|  | + |  | 
|  | + | # These files are above GitHub's recommended file size (50 MB). SUBFOLDER/FILE | 
|  | + | MonteCarlo/fermi.txt | 
|  | + | Examples/mctuple.root | 
|  | + | Examples/mctuple.hbook | 
|  | + | Examples/ntuple.root | 
|  | + | Examples/log | 
|  | + | Examples/omega2p_sim_1.itape | 
|  | + | Examples/ntuple.hbook | 
|  | + |  | 
|  | + | # These are object files. Code that is compiled to machine code, no need fo me to saved/tracked in GitHub. | 
|  | + | # * is a wild card, so anything that has .o at the end is ignored using *.o, while *.o.* says ignore anything that has .o. within the name.  | 
|  | + | *.o | 
|  | + | *.o.* | 
|  | + | </pre><br> | 
|  | + |  | 
|  | + |   <li><u>Ignore already checked in files</u>: <br> | 
|  | + |         - Since you already tried and failed to fully push those file, you'll need to untrack them <br> | 
|  | + |         - From your terminal type <b>git rm --cached FILENAME </b><br> | 
|  | + |           Hint - You can copy/paste from the find results <b>git rm --cached /SUBFOLDER/FILENAME </b><br> | 
|  | + |         - Do this for all files that require it before proceeding </li><br> | 
|  | + |  | 
|  | + |  | 
|  | + | # If you want to ignore a file that is already checked in, | 
|  | + | # you must untrack the file before you add a rule to ignore it. | 
|  | + | # From your terminal, untrack the file: | 
|  | + | #    | 
|  | + |  | 
|  | + |  | 
|  | + |  | 
|  | + |  | 
|  | + |  | 
|  |  |  |  | 
|  | == <u><i>Extras</i></u> == |  | == <u><i>Extras</i></u> == |