Gitignore setup help from a real person

Hi I am David and am looking for someone to help me set up my gitignore so all my system is not a part of the github and im having a little trouble figuring it out.

1 Like

I’m sure there’s someone here who can do that, if you describe a bit more what you need. Mentioning which tools you are using would be helpful, to. Simply put a .gitignore file is just a list of files, directories, and patterns to ignore, or to override ignore rules from a parent directory.

This sounds a bit like you might have run git init somewhere in a system directory. If that’s the case a .gitignore file is not what you need, you should recreate the repository where you actually want it.

1 Like

I am new to to git hub and coding and to the Atom text editor. I am running Linux Mint 20 cinnamon desktop.now that i think of it i have been running git from the terminal straight from linux and not any folder. i deleted the practice repositories i had created locally and on the github so nothing personal was in them. Thats why i am trying to set up a gitignore and repository for my practices and also as i learn to code. i came from a windows background and was exploring linux in the early 2000s it was susy linux i think back then. so i am fairly new to linux as well,

1 Like

I guess that means you did that in your home folder? That’s probably not what you want to do. Usually it’s best to use one repository per project. Each repository has its own root folder, and to create the repository you need to run git init in that folder. Conversely, if you clone an existing repositoriy git will create the repository folder for you.

Things outside the repository folder cannot be added, .gitignore files are meant for stuff inside that you don’t want to add (e.g. build artifacts).

So, if you want to create a practice repository you’d do something like this:

mkdir practice
cd practice/
# create your files and stuff
git init
git add file_a file_b ...

And then commit, push, or whatever. :wink:

Ok thank you very much. I used the top two lines and made a practice file in my Home folder and also on my terminal. now how do i make that repository on github? from my terminal and also to add that folder to terminal when i restart the computer?

  1. Create a new repository on Github. Do not use any of the initialization options.
  2. Add the Github repository as a remote to your local repository (using git remote add). See Working with Remotes for details.
  3. Push.

What do you mean by this? Assuming your disk doesn’t break the repository folder should be right where you left it after rebooting.

i figured out my previous questions, thank you very much for your time. when i have it i will have it. i created the repository and when i pushed it it gave me an email error message. I am trying now to figure out how to not push the email with the commit?

master -> master (push declined due to email privacy restrictions)

If you want to use the “keep my email address private” feature you need to set your commit email address to the @users.noreply.github.com address shown with that setting.

The tricky thing is that to push your existing commits you’ll have to change their author email. There are basically two ways to do that:

  • If there are just a few commits, you can do an interactive rebase and use git commit --amend --reset-author on each commit.
  • If there are a lot of commits to change, using git filter-branch might be much smoother.

Both procedures are described in Rewriting History. The first one is basically at the top, the second one at the end of the chapter. I suppose it’s a hint about the perceived complexity. :wink:

thank you sister.im trying to read and study as well so i can git this thing down pat. This Atom also seems it will be a learning curve. :wink: :upside_down_face:

I have a dilemma i could use help with. I changed editors got rid of Atom as it was causing all kinds of freezes on my system and am using pycharm. Pycharm has VCS inside its core and i could use some help whether I should use command line for git or try to incorporate it and learn it from inside pycharm or both. I am on linux Mint 20 and learning the python coding language??

First off, use what works best for you. :wink:

However, I think it’s worth learning to use the CLI even if you’re going to mostly work through your IDE. It’s not tied to any particular language or IDE, as long as you have git installed, you can use it. Also there’s the thing that IDEs usually support the basic features pretty well, but if at some point in the future you want to do something more exotic you’ll likely need to use the command line.

i think i somehow added Atom to my github because its loading when i use cli which for me is terminal in linux.

Probably git instead of Github in that case, but yes, that’s possible. Git will launch an editor for certain things (like typing a commit message) and you can configure which one with the core.editor setting.

You can check the current setting with git config core.editor, or git config --show-origin core.editor if you want to see which file(s) set it.