Should I use Git or GitHub

Working with GitHub

Answers to the most common questions

By Jan Mahn and Merlin Schumacher

GitHub, GitLab, Git?

¯ ??? What are Git, GitHub and GitLab and how do they differ?

¯ !!! The Git version control system (VCS) laid the foundation. It was programmed by Linux inventor Linus Torvalds because he was not satisfied with the version control systems available for developing the Linux kernel. Meanwhile, others, above all the Google developer Junio ​​C Hamano, have taken over the further development of Git. To work with Git, you don't need anything except the program of the same name, which is available for all major platforms and architectures and runs locally.

GitHub is a free online platform that Git uses to simplify the hosting of software and its source code. The code is uploaded there using a Git client, hence the name. The company is now also involved in the further development of Git. GitHub is the market leader in the field of Git hosting services and extremely popular with open source developers.

In addition to GitHub, numerous alternatives have developed: The most prominent is GitLab, because - in contrast to the GitHub platform - it is open source and works on its own server. Alternatively, GitLab also offers its platform as a hosted offer.

GitHub, GitLab and the like have a sophisticated interface for managing projects and code. They offer bug trackers, wikis for project documentation and the integration of various services to relieve developers of work. If you want full control over code, users, processes and infrastructure, it is best to use solutions like GitLab.

GitHub for laypeople

¯ ??? I'm not a developer, I just look for open source software sometimes and end up on GitHub all the time. Where can I find the program now?

¯ !!! For outsiders, visiting GitHub for the first time is a bit confusing. For example, if you land on a project page via a search engine and just want to download the finished program, you should see whether there is a "Releases" item in the horizontal menu at the top. In addition to the packaged source code, the developers can also provide installation packages here. If the developers of the project do not use this option, there is the "Clone or download" button at the top right and there the option of downloading the entire content of the GitHub project, called "Repository" at Git, as a zip file. You should scroll down a bit, because further down you will usually find the project documentation, which tells you how to deal with the downloaded code. Often there are also references to finished binary or installation packages.

GitHub account? Yes or no?

¯ ??? I'm a software developer but don't have a GitHub account. Is it even worth it if I am only developing for myself privately anyway?

¯ !!! Perhaps your own projects seem superfluous to others, but they could also be exactly what someone else is looking for. Hence, it is a good idea to share them. Sometimes you get feedback and tips that you didn't expect. In addition, you have the code at your fingertips.

GitHub's prominent status has meanwhile also ensured that potential employers like to take a look at applicants' accounts there. If it looks good, it suggests that the applicant is a passionate software developer.

It can also be useful for companies to present themselves on GitHub. There, applicants can see exactly which tools are being used by the potential new employer, and many people like it when companies participate in open source projects.

Organization account

¯ ??? I want to create Git repositories that are not directly associated with me but with an organization. Do I have to open a commercial account for this?

¯ !!! No. You can set up an organization on GitHub, publish projects there, and work on them with other developers. This can also function as a figurehead by adding a logo and an organizational description. Within the organization, you can manage things like rights for the developers, projects, and developer teams.

Paid account

¯ ??? Does it make sense to pay for GitHub?

¯ !!! It depends very much on your requirements. The biggest advantage of having commercial GitHub access is the private repositories that are not accessible to others. A non-public versioning can also be implemented with your own GitLab instance or on your own hardware. A commercial account tends to be worthwhile if you work with larger teams and want to publish complex or commercial projects.

Log In

¯ ??? Whenever I create a new commit, I have to enter my username and password. Isn't that more convenient?

¯ !!! Yes - and more secure too: Generate an SSH key pair [1] and store the public SSH key on GitHub. You can do this via the page github.com/settings/keys. There you can also store a GPG key with which you can sign your commits. GitHub then verifies the commits you signed using the public key. All you have to do is tell Git the ID of your GPG key:

git config --global user.signingkey:

.YOUR-GPG-KEY-ID

A green box labeled "Verified" will then appear next to your new commits. This verification ensures that all commits you make have been made by you.

Install client

¯ ??? Do I actually need the GitHub desktop client to work with GitHub?

¯ !!! There are several ways to work with GitHub [2]. Use the command line to use the git program, which is usually preinstalled on macOS and Linux; Windows users can find the download at ct.de/yzbe. The desktop client makes it easy to clone, commit and push repositories in a graphical user interface. If you use other Git hosts besides GitHub, we recommend a look at graphical Git clients such as Tower, GitKraken and SourceTree. A commit in Git projects can also be generated directly from many programming environments using an extension.

Big files

¯ ??? I tried to save a large data set in the repository. This makes committing and cloning incredibly long. Isn't that planned?

¯ !!! For this problem there is the Git extension LFS, which GitHub supports. GitHub provides every user with 1 GB of free LFS storage space. LFS replaces the large files with pointers so that you don't have to download huge amounts of data with every checkout. Only when they are edited or accessed does Git download the files.

GitHub Gist

¯ ??? I sometimes put notes, useful scripts and link collections on GitHub and share them in forums, for example. Do I always have to create a repository for this?

¯ !!! For this purpose there is the GitHub Gist feature, which can be found at gist.github.com. Here you can put exactly this type of material - i.e. all snippets that do not form a finished project. There is versioning, star ratings and comments from other users as in the repository, but no branches and no readme file.

GitHub and Microsoft

¯ ??? Microsoft bought GitHub. What does that mean for me?

¯ !!! It is not yet possible to say what Microsoft will change. Microsoft will likely move GitHub to its servers in the Azure cloud. The often recommended alternative GitLab was also in Microsoft's cloud until a few months ago. Anyone who provides public projects at GitHub does not have to fear that someone will gain unauthorized access to the code. If you don't want to give up your code, you should run your own server instance, for example from GitLab.

Nice project pages

¯ ??? Many GitHub repositories have lovingly designed project pages. How can I achieve that too?

¯ !!! GitHub creates the project overview page from the README.md file. As for practically everything on GitHub, the markup format Markdown [3] is used here. It's relatively easy to learn, but powerful nonetheless. For starters, you can open the README.md or other Markdown files directly in an editor on the website. To do this, click on the desired file so that GitHub opens it. You can then edit the file with a click on the little pencil in the top right corner.

GitHub Pages

¯ ??? Some GitHub projects appear to have their homepage hosted on a GitHub subdomain. Are these special projects or users?

¯ !!! Every user has this option. The feature is called GitHub Pages and it's free. The page is set up in the settings of a repository. GitHub provides various themes. You create the content yourself in Markdown, with the Markdown blog Jekyll running in the background. After setting up the wizard, you can reach your page under .github.io / . The documentation at pages.github.com explains all the possibilities of the function such as your own templates, error pages and your own domain.

Being found

¯ ??? I published a project, but it is rarely found. What can I do to make it more visible?

¯ !!! The first thing you should do is create a clear and informative README.md file. Preferably with a screenshot. That catches visitors better than a carelessly filled out project page.

It is also helpful to provide a good short description. To do this, go to the project page and click on the small "Edit" button on the right. There you can describe in a short text what your project can do. Optionally, you can also store a project website with further information.

Directly under the project description you can store topics that your project affects. Again, be specific, but try to cover as much as possible. GitHub also suggests popular topics as you type.

Collaborate

¯ ??? I have a suggestion for improving a third-party project on GitHub. How can I best communicate this to the developers?

¯ !!! If you do not want to or cannot contribute any code, create an "Issue", ie a problem report for the project, by precisely describing the suggestion or your problem. Most developers welcome feedback and suggestions for improvement.

If you want to contribute improved code yourself, it is best to create your own version of the repository (fork) and add your changes. Now commit the new code and upload it to GitHub using a push.

You can then generate a so-called pull request on the project page of your fork. As a result, the original developer receives a request with your code changes, which he can import directly into the project and discuss with you.

Contact with developers

¯ ??? I want to message a developer, but I can't get in touch on GitHub.

¯ !!! Unfortunately, GitHub does not provide for that. You can only see whether the developer has stored an email address or homepage on his profile page. Sometimes a search within the project files also leads to an email address. It is unpleasant, but also possible, to open an issue for the project in question and ask for contact there. ([email protected])

Links and downloads: ct.de/yzbe

literature

  • [1] Heike Jurzik, Safe on the move, encrypt connections with SSH, c’t 14/2018, p. 144
  • [2] Herbert Braun, Unforgotten, First steps with the version control system Git and with GitHub, c’t 5/2014, p. 176
  • [3] Moritz Sauer, developer pidgin, universal markdown language Markdown, c’t 7/2013, p. 162