Home‎ > ‎Windows 10 Bash‎ > ‎

Windows 10 Bash: Git, Git-hub, and Bitbucket

On Windows 10 Bash, you will need to setup git, create ssh keys to give to Git-hub, Bitbucket, or other repo systems, and set some basic configurations for git.

Prerequisites

  1. Complete all of the items in Getting Started with Windows 10 Bash


    Install Git

    1. Use superuser privileges (see Superuser or Root Privileges section)
      • "sudo su"
    2. Update the list of packages "sudo apt-get -y update"
    3. Install git (it is a lot of stuff and takes a bit): "apt-get install git-all"


    Github and Bitbucket

    Git Configuration

    There are some basic configurations that you need to do for a new git installation:

    Configure your name and email address. 
    1. git config --global user.email "your_github_email@example.com"
    2. git config --global user.name "yourGithubName"
    Note: You need to use the same email address that is used with your bitbucket account.  For name, I use the same name that I have in my github profile (aka YasharF in https://github.com/YasharF ).  Note that since these are global configs, you will be using the same user info across github and bitbucket.  Also, in your github account, you may want to mark your email address as private if you haven't already.

    Configure your git push default to matching (or simple).  The following is to set it to matching:
    • git config --global push.default matching


    Setup your SSH key

    Generate the key

    1. Generate the key 
      • ssh-keygen -t rsa -b 4096 -C "your_github_email@example.com"
    2. User the default location to save when prompted (aka /users/you/.ssh/id_rsa)
    3. Type a password if you want to enter the password every time that the key is used to connect to github, or press enter for no password when prompted.  Not having a passphrase for your key is not a good security practice but is very convenient.

    Install the key

    1. eval "$(ssh-agent -s)"
    2. ssh-add ~/.ssh/id_rsa

    Add the SSH keys to your Github or Bitbucket account:

    1. Login to your github or bitbucket account using a web browser
    2. Go to the account setting, and the section for SSH keys, and pick adding a new key.
    3. Copy/Paste the content of your public key (~/.ssh/id_rsa.pub).  To easily see the content for a console copy-paste with the mouse selection, use the command "cat ~/.ssh/id_rsa.pub".  The key includes and starts with 'ssh-rsa' and ends with and includes your email address.
    Comments