banner



How To Use Git On Windows

Read Time: 6 mins Languages:

Git has come a long way since its introduction, and has become significantly easier to work with in a Windows environment. In this tutorial, we are going to get setup with Git on Windows.

This article was written with the GUI in mind. I will NOT get over the command line usage, considering there are many resources that already teach that aspect of Git. I made this for the true Windows users, the GUI ninjas. If you are like me and prefer a GUI over the command line, then this is the tutorial for you!


Step one: Install Git

The first thing we need to practice is install Git on Windows; yous can exercise then with the following steps:

  1. Download and install the latest version of Git for Windows
  2. Utilise the default options for each step in the installation
  3. Remove Git Bash Desktop Icon
  4. Become to Beginning > All Programs > Git > Git GUI and brand a Desktop Shortcut

Strangely, the final step seemed a scrap confusing if you don't have Windows Search enabled. You tin can also pivot Git GUI to the taskbar and/or the Start Menu.

It is of import that you lot use all the default settings because they are supported past all major repository vendors such every bit Github, Bitbucket, and Beanstalk.


Step 2: Setup SSH Keys

Compared to Git Bash, setting upward a SSH Key for your computer is relatively easy. Only open Git GUI.

Git Gui Git Gui Git Gui

At present click on Show SSH Key under the Assistance Bill of fare.

Git Gui SSH Key Git Gui SSH Key Git Gui SSH Key

Information technology'southward possible that there is already a SSH key on your arrangement; it's best to remove or backup the central if yous do not know where information technology came from. To exercise so, simply remove all files within: C:\Users\<username>\.ssh. Be sure to supervene upon <username> with your Windows username.

You lot can generate a SSH key by clicking on the Generate Key push. When you do so, yous will need to supply a passphrase for security purposes. Retrieve this passphrase; y'all will need to use it afterward.

Setup SSH Key with Hosted Git Repository

Github is non the simply hosted Git repository available. It is, however, the most popular solution, and nosotros'll utilise it every bit an example.

The SSH key you created allows you lot to push your changes to a hosted repository. And then, in order to push changes from your computer, Github needs to know your public SSH key. That is easily attainable; just click the "Re-create to Clipboard" button.

Next, you demand to provide your hosted repo service with your public SSH key. Similar to Github, nearly of these sites usually have a tab, called "SSH Keys". Click the tab and add together your SSH key to the website.

Git Gui Stage Git Gui Stage Git Gui Stage

The Title field is only a label to identify the SSH key; it is for your purposes but. For example, "WindowsPc", "Macbook", "Linux". Just make sure it accurately describes what device the SSH key is assigned to.


Stride iii: Getting Started with Git

Adjacent, we need a Git repository, and nosotros'll create a new remote repository on Github.

Create a Remote Repository

When creating a remote repo, Github offers to initialize the repository for you. This is a nice option, just for the purpose of learning how to setup for culling websites, nosotros will not check the initialize box.

Github Create Repository Github Create Repository Github Create Repository

Create a Local Repository

Now, we'll create a local repository. In our Git GUI, click on "Create New Repository".

Git Gui Git Gui Git Gui

Select the location you wish to shop your repository in. It is important to notation that the selected repository location MUST NOT exist. So select the location y'all wish, and append the name of the folder you want the repository to be in, like this:

Git Gui New Repository Git Gui New Repository Git Gui New Repository

In gild for this new repository to exist initialized, you must showtime create a file, any file, in your local repo. Then, you must Commit and Push button to the remote Git repository location. We'll review committing and pushing in Pace 4; I recommend you skip ahead if y'all practise not wish to clone a repository. Your remote Git location should look like similar to this: git@github.com:Username/repository-proper noun.git.

Clone a Remote Repository to a Local Repository

As I noted before, Github tin can provide yous with an already initialized repository, and you can get started a lot faster than yous normally would. In order to clone a repository, click on the "Clone Existing Repository" link in the Git GUI window. An existing repository is 1 that is already initialized and/or has commits pushed to information technology.

In the Source Location field, fill up in the Git remote repository location. The Target Directory field works much like how I showed you how to create a repository before. Brusque version: select the location and append the binder you want the files to be in. Git will attempt to create it, and it will neglect if it already exists.

Git Gui Clone Repository Git Gui Clone Repository Git Gui Clone Repository

There you become; at present you should exist all set to piece of work locally.


Step 4: Working with the GUI Client

The Git GUI makes it easier to perform Git-related tasks, such as staging changes, commits, and pushes.

Stage Inverse

When y'all move files to a Git directory, yous volition see all the files in the "Unstaged Changes" window. This basically means that new files take been added, removed, updated, etc. You tin click on the "Rescan" button in gild to see any new changes that may have occurred.

Git Gui Stage Git Gui Stage Git Gui Stage

When you click the "Stage Inverse" button, it will try to add all the new files to the Git index.

Git Gui Stage Git Gui Stage Git Gui Stage

Commits:

After you've staged your changes, yous then need to commit them to your local repository. Type a Commit Bulletin that makes sense to the changes that were fabricated. When you are washed, press the Commit push button.

Git Gui Commit Git Gui Commit Git Gui Commit

Pushing

Before others can admission our new code, we need to push these changes to our hosted repository. Without pushing the changes, others would non exist able to access the lawmaking.

Before we tin proceed to push button, nosotros demand fix up a location to push to. Most folks refer to this location as "origin". If you wish, you can select an choice in the "Further Actions" area, but in my experience, doing naught will benefit you the most. You can always clone or button later.

Git Gui Remote Add Origin Git Gui Remote Add Origin Git Gui Remote Add Origin

After calculation the remote origin, y'all can only press the Push. It will ask you where you desire to push to; most likely "origin" will exist pre-selected (and it may be your but pick). And so just click on the Push button once again.

Git Gui Push Git Gui Push Git Gui Push

Next, you will be bombarded with window afterward window. But don't worry, this only happens the outset time. Just follow the instructions given to you.

Git Gui Push Git Gui Push Git Gui Push

Git will enquire you the passphrase of your SSH Primal.

Git Gui Stage Git Gui Stage Git Gui Stage

Don't panic if you see more so one request of your passphrase. Information technology is completely normal! You lot don't accept to worry as long equally yous are non told the passphrase was wrong. Seeing multiple requests for your passphrase commonly only occurs once per SSH central.

In the event that your push was consummate, you should be greeted with a window similar to this:

Git Gui Stage Git Gui Stage Git Gui Stage


Before I permit you become, here'south a list of fantastic resource for continuing your Git learning.

  • Git Essentials (Tuts+ Premium Class)
  • Github - Unlimited Free Public Repositories
  • Bitbucket - Unlimited Gratuitous Public and Individual Repositories
  • Beanstalk - Private Git with Keen FTP Deployments
  • DeployHq - Deploy any Git repo over FTP
  • Like shooting fish in a barrel Version-Control With Git
  • Terminal, Git, and GitHub for the Rest of Us

Did you notice this mail service useful?

How To Use Git On Windows,

Source: https://code.tutsplus.com/tutorials/git-on-windows-for-newbs--net-25847

Posted by: greenbergbaccoulesty.blogspot.com

0 Response to "How To Use Git On Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel