как установить git на linux mint
Git Guides
How to install Git on any OS
Git can be installed on the most common operating systems like Windows, Mac, and Linux. In fact, Git comes installed by default on most Mac and Linux machines!
To see if you already have Git installed, open up your terminal application.
Install Git Using GitHub Desktop
Installing GitHub Desktop will also install the latest version of Git if you don’t already have it. With GitHub Desktop, you get a command line version of Git with a robust GUI. Regardless of if you have Git installed or not, GitHub Desktop offers a simple collaboration tool for Git. You can learn more here.
Install Git on Windows
Install Git on Mac
Install Git From an Installer
Note: git-scm is a popular and recommended resource for downloading Git on a Mac. The advantage of downloading Git from git-scm is that your download automatically starts with the latest version of Git. The download source is the same macOS Git Installer as referenced in the steps above.
Install Git from Homebrew
Homebrew is a popular package manager for macOS. If you already have Homwbrew installed, you can follow the below steps to install Git:
Install Git on Linux
Fun fact: Git was originally developed to version the Linux operating system! So, it only makes sense that it is easy to configure to run on Linux.
You can install Git on Linux through the package management tool that comes with your distribution.
Note: You can download the proper Git versions and read more about how to install on specific Linux systems, like installing Git on Ubuntu or Fedora, in git-scm’s documentation.
Other Methods of Installing Git
Looking to install Git via the source code? Learn more here.
Get started with git and GitHub
Review code, manage projects, and build software alongside 40 million developers.
Как пользоваться GitHub на компьютере с Linux
GitHub — один из используемых сервисов размещения проектов для совместной разработки. Он поддерживает контроль версий, возможность отслеживания изменений кода, сравнение строк, а также он бесплатен.
В данной статье приведены примеры использования сервиса на компьютере под управлением операционных систем семейства Linux. Мы рассмотрим, как создать проект на локальном компьютере и залить его на сервис с помощью командной строки. Рассмотренные варианты использования git также можно применять на desktop системах, запустив окно терминала.
Установка git
Управление выполняется с помощью приложения git. Если его нет в системе, установку можно выполнить из репозитория.
Если используем CentOS / Red Hat:
yum install git-core
Если используем Ubuntu / Debian:
apt-get install git
Если мы хотим воспользоваться сервисом с компьютера Windows или Mac OS, необходимо скачать и установить desktop версию с официального сайта.
Синтаксис
Команды имеют следующий синтаксис:
* полный перечень опций, команд и аргументов можно получить командой man git.
Создание проекта на локальном компьютере
Прежде чем отправить проект на GitHub, создаем его на нашем компьютере. Для этого переходим в каталог с файлами проекта:
Инициализируем проект для git:
Мы получим ответ похожий на:
Initialized empty Git repository in /projects/.git/
Это означает, что репозиторий git создан.
Теперь добавим файлы в репозиторий:
* данной командой мы добавили папку и ее содержимое в репозиторий git.
Отправка данных на GitHub
Теперь можно отправить данные на сервис. Для этого у нас должна быть зарегистрированная учетная запись и создан репозиторий на GitHub.
Создание репозитория
Переходим на портал github.com и входим в систему или проходим несложную регистрацию:
Проходим процесс подтверждения, что мы не робот. Затем завершаем несколько шагов регистрации, нажимая Submit. В итоге мы получим письмо на адрес электронной почты, которую указали при регистрации. Необходимо будем подтвердить email, перейдя в письме по кнопке Verify email address.
Создаем репозиторий. Для этого кликаем по иконке профиля и переходим в раздел Your repositories:
И кликаем по кнопке New. В следующем окне даем название репозиторию и нажимаем Create repository:
Мы увидим страницу с путем к репозиторию:
Заливаем проект в репозиторий на GitHub
Добавляем комментарий к нашему проекту:
* где Очередное изменение проекта — произвольный комментарий; параметр -a указывает, что комментарий нужно применить ко всем измененным файлам.
Теперь подключаемся к созданному репозиторию:
git remote add origin https://github.com/dmosktest/project1.git
* где dmosktest — логин, который был указан при регистрации на github, а project1 — название, которое мы задали, когда создавали репозиторий.
* удалить удаленный репозиторий можно командой git remote rm origin.
Закидываем проект на GitHub:
git push origin master
* где master — ветка проекта (веток может быть несколько).
В нашем проекте на GitHub должны появиться файлы проекта:
Получение файлов с GitHub
Для загрузки на компьютер файлов, создаем каталог с проектом и переходим в него:
Проводим начальную настройку локального репозитория:
Подключаемся к удаленному репозиторию:
git remote add origin https://github.com/dmosktest/project1.git
Скачиваем проект командой:
git pull https://github.com/dmosktest/project1.git master
Клонирование проекта
Например, использую наш репозиторий:
git clone https://github.com/dmosktest/project1.git
* данная команда создаст в текущей папке каталог project1 и инициализирует его как локальный репозиторий git. Также загрузит файлы проекта.
Возможные ошибки
1. При попытке отправить данные на GitHub, получаем ошибку:
error: src refspec master does not match any.
error: failed to push some refs to ‘https://github.com/dmosktest/project1.git’
* где dmosktest/project1.git — путь к нашему репозиторию.
Причина: проект ни разу не был зафиксирован (закоммичен).
Решение: добавляем комментарий к нашему проекту:
How to install Git on Ubuntu 18.04 / Linux Mint 19?
Developers must use all available tools to make quality software. Some of these tools do not go directly to the software or the code but to its management. For example, version control is important to ensure that changes are made to the code in an orderly fashion. In this segment, Git seems to be the most logical alternative for this task. So in this post, we will show you how to install Git on Ubuntu 18.04 and Linux Mint 19.
Git is a free and open source distributed version control system. It is perhaps the most popular within the branch as millions of developers use it to control software versions. Ease of use, community support, and efficient version control are the main features of Git. In addition, it is open source and free, which makes it ideal for all projects.
Of course, Git is available for almost any Linux distribution. It also has versions for Windows or MacOS. So no matter what platform you develop on, you will always have the advantages of using Git.
Install Git on Ubuntu 18.04 / Linux Mint 19
As I mentioned earlier, Git is available for many Linux distributions. And Ubuntu is no exception. For Ubuntu and Linux Mint we have two different ways to install Git.
First, Git is in the official Ubuntu and Linux Mint repositories. However, the available version is somewhat outdated and the development of Git is quite active. Installing Git in this way is quite simple but will deprive you of having the latest version available with all its advantages.
So, open a terminal and run:
1.- Install Git from the main repositories
Then, check the installed version.
2.- Git version
As we can see, the version that is in the official repositories is 2.17. However, the latest version available is 2.21 at the time of writing this post.
Fortunately, there is a PPA for Ubuntu and Linux Mint that we can use to install the latest version of Git very easily.
So, open a terminal and run:
3.- Adding the external repository
Then, refresh the APT cache.
If you already have it installed, run this command.
Or, if you do not have it installed.
After that, check the installed version.
4.- Git latest version installed
So we can install Git on Ubuntu 18.04 and Linux Mint 19 using the PPA of the development team.
Conclusion
Git is quite a reference when it comes to version control. Many developers use it for their daily work and offer a great guarantee for it. In addition, installing it is quite simple and is within everyone’s reach.
derhuerst / intro.md
Installing Git – the easy way
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Choose one of the following options.
Determine on which Linux distribution your system is based on. See List of Linux distributions – Wikipedia for a list. Most Linux systems – including Ubuntu – are Debian-based.
Debian-based linux systems
You can use Git now.
Red Hat-based linux systems
You can use Git now.
Homebrew […] simplifies the installation of software on the Mac OS X operating system.
You will be offered to install the Command Line Developer Tools from Apple. Confirm by clicking Install. After the installation finished, continue installing Homebrew by hitting Return again.
Step 2 – Install Git
You can use Git now.
Installing Git on Windows
This comment has been minimized.
Copy link Quote reply
alhadhrami commented Nov 9, 2017
Wrong link in ‘intro.md’ for «Instructions for Windows». I was going to create a pull request, but then remembered that doesn’t exist in gist.
This comment has been minimized.
Copy link Quote reply
rgnest commented Jan 6, 2018 •
You shoud before do «cd» the directrory should be yours home. Or will have error.
I mean macos.
This comment has been minimized.
Copy link Quote reply
mithlesh4257 commented Jan 7, 2018
Git is not installing in Ubuntu. Please help!
This comment has been minimized.
Copy link Quote reply
elseagle commented Jan 18, 2018
@mithlesh4257 try
sudo apt-get update then sudo apt-get upgrade followed by sudo apt-get install git
This comment has been minimized.
Copy link Quote reply
Kaarthick912 commented Mar 5, 2018
This comment has been minimized.
Copy link Quote reply
Aztechtcs commented Mar 11, 2018
This comment has been minimized.
Copy link Quote reply
Joshua56 commented Mar 30, 2018
I am having the same problem in my linux mint
This comment has been minimized.
Copy link Quote reply
Joshua56 commented Mar 30, 2018
This the error of the code
This comment has been minimized.
Copy link Quote reply
reddyvenu commented Apr 10, 2018
This comment has been minimized.
Copy link Quote reply
imad-bouramana commented Apr 29, 2018
try this repository
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
This comment has been minimized.
Copy link Quote reply
webbertakken commented Aug 15, 2018 •
This comment has been minimized.
Copy link Quote reply
oscrx commented Sep 13, 2018 •
Wrong link in ‘intro.md’ for «Instructions for Windows». I was going to create a pull request, but then remembered that doesn’t exist in gist.
Exactly this 😀
But thanks for the guide.
This comment has been minimized.
Copy link Quote reply
Princewillsarlex commented Nov 15, 2018
This comment has been minimized.
Copy link Quote reply
adkumar321 commented Jan 18, 2019
sudo apt-get install aptitude
sudo aptitude install git
This comment has been minimized.
Copy link Quote reply
DuncantheeDuncan commented Mar 9, 2019 •
Thanks it now installed
But Git-it command doesn’t work and git-it verify
So what the next step please help
I’m using Kali Linux
This comment has been minimized.
Copy link Quote reply
NetJayNoob commented Mar 19, 2019
I am having issues with setting the port. When I type ‘set port 80’ I get back as an error: «you can’t set option ‘port’. Available options: [‘target’, ‘http_port'» etc. will this affect my check runs later?
This is on Kali Linux, and is after ‘set target 192.168. )
This comment has been minimized.
Copy link Quote reply
Anthomy1 commented May 30, 2019
Thanks it now installed
But Git-it command doesn’t work and git-it verify
So what the next step please help
I’m using Kali Linux
This comment has been minimized.
Copy link Quote reply
Anthomy1 commented May 30, 2019
I need help.
I’m using Kali Linux.
This comment has been minimized.
Copy link Quote reply
virgilwashere commented Jun 4, 2019
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
Install git on Ubuntu
The most current stable version of Git for Ubuntu.
For release candidates, go to https://launchpad.net/
Hope that helps someone.
This comment has been minimized.
Copy link Quote reply
virgilwashere commented Jun 4, 2019
⚠️ Any additional repositories added to the Kali sources.list file will most likely BREAK YOUR KALI LINUX INSTALL.
If this doesn’t do it, I’d be real careful now.
This comment has been minimized.
Copy link Quote reply
sagynov commented Jun 16, 2019
This comment has been minimized.
Copy link Quote reply
Knlsharma commented Jul 22, 2019
This comment has been minimized.
Copy link Quote reply
Lucifer8759 commented Jul 23, 2019
I need help.
I’m using Kali Linux.
This comment has been minimized.
Copy link Quote reply
mark-nirdesh commented Dec 17, 2019
I need help.
I’m using Kali Linux.
This comment has been minimized.
Copy link Quote reply
ocBruno commented Feb 14, 2020
Just a heads up!
The Instructions for Windows is linking to the linux instructions
This comment has been minimized.
Copy link Quote reply
CyberChick111 commented Mar 6, 2020
@mithlesh4257 try
sudo apt-get update then sudo apt-get upgrade followed by sudo apt-get install git
This one worked!! Thanks
This comment has been minimized.
Copy link Quote reply
Phontera commented Mar 31, 2020
It worked! Thank you.
This comment has been minimized.
Copy link Quote reply
gprakarsh commented Aug 10, 2020
This comment has been minimized.
Copy link Quote reply
ASCassinda commented Aug 25, 2020
This comment has been minimized.
Copy link Quote reply
Cyber-Guy24 commented Sep 3, 2020
Thanks mark-nirdesh that worked for me as well
This comment has been minimized.
Copy link Quote reply
wajeehas commented Sep 13, 2020
I have tried installing homebrew via mac os terminal, but it keeps asking me for a password. does anyone know which password this is? it comes up as a key sign.
This comment has been minimized.
Copy link Quote reply
derhuerst commented Sep 14, 2020
I have tried installing homebrew via mac os terminal, but it keeps asking me for a password. does anyone know which password this is? it comes up as a key sign.
It looks like it uses sudo to install itself to a specific location on your computer; sudo requires your password. You will have to put your macOS user’s password.
This comment has been minimized.
Copy link Quote reply
mahfudivan commented Sep 23, 2020
I have tried installing homebrew via mac os terminal, but it keeps asking me for a password. does anyone know which password this is? it comes up as a key sign.
your laptop password, I use a macbook, I also enter my laptop password
This comment has been minimized.
Copy link Quote reply
temoke-levelops commented Nov 5, 2020
Works for Mac! Where do I give thumbs up?
This comment has been minimized.
Copy link Quote reply
mavaddat commented Dec 19, 2020
They (incorrectly) copied the entire markdown-laden code-block and pasted that into the bash terminal, which of course bash cannot interpret as a command. Do not paste the markdown (e.g., «`shell ) into bash — that part is just for formatting the code on GitHub.
This comment has been minimized.
Copy link Quote reply
AssefaDemeke12 commented Dec 26, 2020
git hub setup for linux
This comment has been minimized.
Copy link Quote reply
Poojap19create commented Mar 26, 2021
I am getting an error while installing git for UBUNTU Can anybody help please
This comment has been minimized.
Copy link Quote reply
mavaddat commented Mar 29, 2021 •
I am getting an error while installing git for UBUNTU Can anybody help please
Your Ubuntu version is no longer maintained. You need to update your distribution to a version that is within its support lifetime. For example, try using this upgrade combination:
Установка Git
Прежде чем использовать Git, вы должны установить его на своём компьютере. Даже если он уже установлен, наверное, это хороший повод, чтобы обновиться до последней версии. Вы можете установить Git из собранного пакета или другого установщика, либо скачать исходный код и скомпилировать его самостоятельно.
В этой книге используется Git версии 2.8.0. Хотя большинство используемых нами команд должны работать даже в старых версиях Git, некоторые из них могут не работать или действовать немного иначе, если вы используете старую версию. Поскольку Git отлично справляется с сохранением обратной совместимости, любая версия после 2.8 должна работать нормально.
Установка в Linux
Если вы хотите установить Git под Linux как бинарный пакет, это можно сделать, используя обычный менеджер пакетов вашего дистрибутива. Если у вас Fedora (или другой похожий дистрибутив, такой как RHEL или CentOS), можно воспользоваться dnf :
Если же у вас дистрибутив, основанный на Debian, например, Ubuntu, попробуйте apt :
Чтобы воспользоваться дополнительными возможностями, посмотрите инструкцию по установке для нескольких различных разновидностей Unix на сайте Git https://git-scm.com/download/linux.
Установка на Mac
Существует несколько способов установки Git на Mac. Самый простой — установить Xcode Command Line Tools. В версии Mavericks (10.9) и выше вы можете добиться этого просто первый раз выполнив ‘git’ в терминале.
Если Git не установлен, вам будет предложено его установить.
Если Вы хотите получить более актуальную версию, то можете воспользоваться бинарным установщиком. Установщик Git для OS X доступен для скачивания с сайта Git https://git-scm.com/download/mac.
Установка в Windows
Для установки Git в Windows также имеется несколько способов. Официальная сборка доступна для скачивания на официальном сайте Git. Просто перейдите на страницу https://git-scm.com/download/win, и загрузка запустится автоматически. Обратите внимание, что это отдельный проект, называемый Git для Windows; для получения дополнительной информации о нём перейдите на https://gitforwindows.org.
Для автоматической установки вы можете использовать пакет Git Chocolatey. Обратите внимание, что пакет Chocolatey поддерживается сообществом.
Установка из исходников
Многие предпочитают устанавливать Git из исходников, поскольку такой способ позволяет получить самую свежую версию. Обновление бинарных инсталляторов, как правило, немного отстаёт, хотя в последнее время разница не столь существенна.
Если вы действительно хотите установить Git из исходников, у вас должны быть установлены следующие библиотеки, от которых он зависит: autotools, curl, zlib, openssl, expat, and libiconv. Например, если в вашей системе используется dnf (Fedora) или apt-get (системы на базе Debian), вы можете использовать одну из следующих команд для установки всех зависимостей, используемых для сборки и установки бинарных файлов Git:
Для того, чтобы собрать документацию в различных форматах (doc, html, info), понадобится установить дополнительные зависимости:
Пользователи RHEL и производных от неё (таких как CentOS или Scientific Linux) должны подключить репозиторий EPEL для корректной установки пакета docbook2X
Если вы используете систему на базе Debian (Debian/Ubuntu/Ubuntu-производные), вам так же понадобится установить пакет install-info :
К тому же из-за различий имён бинарных файлов вам понадобится сделать следующее:
Когда все необходимые зависимости установлены, вы можете пойти дальше и скачать самый свежий архив с исходниками из следующих мест: с сайта Kernel.org https://www.kernel.org/pub/software/scm/git, или зеркала на сайте GitHub https://github.com/git/git/releases. Конечно, немного проще скачать последнюю версию с сайта GitHub, но на странице kernel.org релизы имеют подписи, если вы хотите проверить, что скачиваете.
Затем скомпилируйте и установите:
После этого вы можете получать обновления Git посредством самого Git: