Skip to content
loading...

How to properly set up Git on your computer!

Landon Patmore on January 24, 2018

Installing Git OSX Setup If you have never used Git on your computer, you most likely will not have it installed. Pull up yo... [Read Full]
markdown guide
 

I would highly recommend using Git Bash as it gives you information about the branch you are working on right in the terminal compared to command prompt which does not tell you any information, as well as you can use Linux commands.

Windows guys actually made a plugin for PowerShell which you can install with Install-Module posh-git -Scope CurrentUser that's it,

 

Hi Saurabh,

I just looked at the plugin and it looks pretty awesome. But the issue I see is now is that even though the plugin can be installed for Powershell, you still need to install Git through the means I provided in the article. This now means the user has to install two things rather than one.

While it may be small, I personally would stay with Git Bash, especially for the Linux commands and so that I wouldn't have to install another thing on my system.

To each is their own, and I will take your comment and add it into the article, thanks for the feedback and another tool to use!

  • Landon
 

So here is my thing; it isn't always about installing the fewest things or whatever. It is about having the tools to do the job in the way that works best for you; especially when those things don't add additional strife to others on your team.

If you are working on Windows -- you are going to benefit from using PowerShell. Especially if you spend some time to customize your profile (just like you would with your bashrc, etc)

If you are working primarily with Linux systems then it makes sense to stick with that. You have the Linux Subsystem for Windows that is pretty slick.

The only issue I take with the article (all very good information) is that it is implied that this is THE proper way to do it. That just isn't the case. There is more than one way to skin this cat; and when personal opinion comes into play (like it does with so many things about how you do work) it is not really possible to say "this way is the correct way".

 

I'd highly recommend cmder.net for Windows. It includes Linux commands, git, and more!

yeah, cmder is the coolest terminal available for windows along with hyper.is

 

Git bash is definitely worth it. You can also use a GIT Prompt to see the status of the git repo right there in your console. Setting up git prompt

 

Came here to say this; been using this with git from PowerShell and it is pretty much the bees knees.

 

One more bit I consider critical in a proper git setup:

git config --global core.excludesfile '~/.gitignore'
# on a mac:
echo .DS_Store >> ~/.gitignore
# If you use vim
echo '.*.sw[po]' >> ~/.gitignore
# And any other files that should never be checked into git in ANY repo
 

Hi Daniel,

I wish I could give you a cookie, I forgot about global .gitignores myself.

I will add this in!

Thanks!

 
 

Nice. A couple of assumptions I'd highlight though - the linux instructions are Debian specific, and git doesn't require a github account (this is important because a lot of newbies think they're some kind of official part of git). I know your post has github as a tag, but the title implies it's a general git tutorial.

 

Hi Ben,

I wrote this up for a class and completely forgot about changing it to be more broad. When I’m back from class, I will change it. Thanks!

 

Thanks for an easy to follow tutorial!

At step 5 in "Generating a SSH Key" when I write "ssh-add -K ~/.ssh/id_rsa" I get the error "ssh-add: unknown option --K", do you know how to deal with this?

I'm new to git and can't find anything when searching for the error.
I hope you can help!

 

Hi Maren,

As the error says, you wrote “—K” instead of “-K”. If it throws you an error even with that, try “-k”.

Hope it helps.

  • Landon
 

Hi Landon,

That was exactly the help I needed!
My problem is now solved :)

Thank you so much!!

 

Hi, Landon.

First, the article is pretty good. Kudos for that. :)

The only (minor) thing I can comment about is your comparison of PowerShell as being the same as Command Prompt. They're not. In fact, PowerShell is a completely different shell environment. It's simply the shell that Windows should've always had.

Keep the good work!

Jorge

 

Hi Jebarsallo,

Thanks for the help! I am not a windows user, so I don’t know this! When I get near my computer again, I will fix it!

Thanks!

 

If you're going to install on windows, see if there is already a package for it via chocolatey.org. Chocolatey is much more useful for managing installations, and the more people use it, the more things are kept in sync.

 
 

Awesome write-up!! I wish I'd had all this written out when I first got started. 💯

 

I think you need a lower case 'k' as the parameter.

ssh-add -K ~/.ssh/id_rsa
unknown option -- K
-k Load only keys and not certificates.

 

Hi NetBzz,

I took that directly from GitHub’s guide on how to create SSH keys.

It works perfect for me!

 

It works because you're using macOS. On any other Linux distro that uses OpenSSH will ask for the lowercase 'k'.

 

If you work with GitHub I think that hub is really useful

 
 

U should not make the assumption that everybody in the Linux ecosystem is using Ubuntu/Debian.

code of conduct - report abuse