The repository version control system was a revolutionary step in team development, documentation, and project management. The ability to maintain public repositories has also given many users access to software developed by the community. One of the most popular repository hubs is GitHub, in this article we will look at ways to work with it!
What is Git and GitHub?
Git is a repository version control system that provides a means of managing collections stored on a server with the ability to collaboratively maintain a project.
GitHub is a platform based on the Git system with mechanisms for organising the software development cycle and managing services. It is managed through a web panel, and it is possible to differentiate access to the repository: for yourself, team, and public use.
There are several variants of Git/Github repository architecture:
- Distributed, implemented as a collection of nodes with the ability to publicly access the resource;
- Server-based, implemented by a single node, mainly in the corporate segment;
- Local, for working with repositories on a user's device, as a kind of workspace for projects.
It usually works as follows: the client initialises a repository in a working folder using the git utility:
The user then adds the necessary files to it to work on, logging changes to the working directory, or Working Tree, using the command:
After that, the user creates a snapshot of the working directory or commit and saves the files for further transfer to the repository, where the Commit aggregate is stored. It is possible to send data to local repositories with a single command:
Or to a remote repository such as GitHub or GitLab, but how do you do that? And how do you download a repository from GitHub to your device? Let's explore these questions below.
How do I download a repository to GitHub?
First, let's find the desired project on the official website and go to the Code tab:
There are several options for cloning or fully downloading the repository:
- HTTPS - download is possible via ZIP archive via the button below or via the git clone <URL> command;
- SSH - download is via tunnel with public key authentication on the server;
- GitHub CLI - a utility for GitHub, in the form of a client with slightly extended functionality.
Let's consider the first two options of downloading via the git utility using HTTPS and SSH protocols. For the first option, go to a terminal and type:
Instead of the URL, enter your repository link and wait for the latest version to download. After that a working directory similar to the repository name will be created:
Via SSH the download scheme is a bit different, on the client device view your SSH public keys:
For Linux classically located in the .ssh folder, the file name may vary:
For Windows, the command is as follows:
The key should take the following form, copy your key:
If you don't have a key, create one, using the command:
Then repeat the above steps and copy the key! After that go to the GitHub site and go to user settings via the avatar on the top right. Select SSH and GPG keys on the left:
Click on the New SSH key button and type in the copied key, as well as enter a short name for it:
After clicking Add SSH key and confirm the changes with your account password, the key should be added as an authentication method:
Great! Now we can go to the client terminal and download the repository with the usual command:
The client authenticated to the server with a private key and identified itself with a public key, which allowed access to the repository.
All actions can be performed on powerful cloud servers. Serverspace provides isolated VPS / VDS servers for common and virtualize usage.
It will take some time to deploy server capacity. After that you can connect in any of the convenient ways.