News Trending

How to Clone a Repository Using GitHub Desktop

ad+1

clone-github-repo

Version control is an essential skill for programmers to have. GitHub is one of the more popular programs to run version control, typically through the command line.

The command line is not the only option to work with your code in GitHub, however. GitHub Desktop is an app that gives you the same control over your repositories, in a more visual way. This includes one of the most important version control tasks: cloning a repository. Here’s how.

What Is GitHub Desktop?

GitHub Desktop is an app for Mac and PC users that takes version control from the command line to the desktop. The command line, while powerful, has a steeper learning curve. GitHub created this program to simplify version control.

GitHub Desktop can perform the same tasks you use to control repositories including:

  • Cloning repositories
  • Deleting repositories
  • Updating and saving repositories

Interested? Grab the GitHub Desktop download from the GitHub site.

Download: GitHub Desktop (Free, Windows/Mac)

Download Page for GitHub Desktop

Installing GitHub Desktop

Download and run the installer (an EXE file for Windows or DMG for Mac), then configure your Git in GitHub Desktop.

Main Window to Configure GitHub Desktop

Enter your name and email into the configuration. This is used to label all your work in GitHub Desktop with your name. It is helpful to use the same information you use with your GitHub profile.

Click Continue through the configuration and onto the final landing screen. Click Finish to be taken to the front page of GitHub Desktop.

Signing in to GitHub

To use GitHub Desktop you will need to sign in with your GitHub login. From the front page click on File and scroll down to Options.

Main Window of GitHub Desktop

In the accounts menu, you will see an option to sign in with your GitHub.com account. Sign in with your username and password, then wait to be taken back to the home screen with your information now loaded. Let’s close GitHub Desktop for now.

For this tutorial let’s create a repository using GitHub.com, so we can clone it into GitHub Desktop. You can use an existing repository if you have one, but creating a new one will show how GitHub Desktop works hand-in-hand with GitHub.

Create a Repository

Head over to GitHub.com and sign in with your user name and password.

Let’s create a new repository from the home screen. Around the top left of the screen, you will see an option to create a new repository. Click New to begin the process.

Create New GitHub Repository

Choose a repository name; any name will do as long as you remember it for cloning. For this exercise let’s call the repository “Desktop” so we remember the name.

Let’s set this repository to Public and add a description. Check the box to initialize the repository with a “README” file, this will make it available to clone as soon as you finish.

New GitHub Repository for GitHub Desktop

Click Create repository to complete.

Now that we have a repository created in GitHub, as well as our GitHub profile signed in to GitHub Desktop, we’re ready to use the program!

Cloning the Repository in GitHub Desktop

Now that the repository is created, re-open GitHub Desktop. You will now see the repository we just created is now loaded into the app. Using GitHub Desktop gives you access to all your code on GitHub, outside of your browser.

For this tutorial, we are going to clone the “Desktop” repository onto the computer so we can modify it.

From the front page of the app, click on the Desktop repository and a button will appear to clone the repository you selected.

GitHub Desktop Clone Repository Screen

Click on this button to clone your repository. GitHub Desktop will pop up a window to confirm the name of the repository, as well as the location on your computer you would like to clone it to.

Cloning Repository Using GitHub Desktop

This repository is going to be saved to C:\Desktop. To clarify, this is being saved to my C Drive in Windows, and the folder name is Desktop. Not to be confused with the traditional Windows Desktop location.

Click Clone to copy the repository to this new folder.

Cloned Repository in GitHub Desktop

GitHub Desktop has now copied the repository into a local folder for editing, all without using the command line. From here, you can make additional changes and save to the repository using Commit to master. 

Since the folder is now saved to your computer, you can also navigate to the folder and add files or make changes. GitHub Desktop will save all your changes, and you can commit that way as well.

You now can comfortably clone any repository stored on GitHub, whether your own project or another developer’s code.

Why Not Use the Command Line?

The command line is certainly powerful, and every developer should learn how to use it at a basic level. Knowing the command line is essential to using help GitHub Desktop since some of the terms you will see are the same for both programs.

GitHub Desktop does not replace the command line. GitHub Desktop aims to put your information in front of you, using a graphical user interface (GUI).

Some may find that this is easier to work with. Some may be experts in the command line, but just want a program that they can click through. Programming is always about working smarter. If you find something that works nicely with your workflow, keep it!

Next Steps With GitHub Desktop

Now that you’ve cloned a repository using GitHub Desktop, give modifying your folder a try and committing the changes back to your repository.

GitHub Desktop fits in with text editors, as well as other tools that upgrade your web development skills. The pure power of GitHub can be used to build any project, even Microsoft’s Calculator program is open-sourced on GitHub. GitHub Desktop is just another tool in an already powerful program.

Read the full article: How to Clone a Repository Using GitHub Desktop



from MakeUseOf https://ift.tt/336SUzj
via IFTTT

0 comments: