diff --git a/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md b/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md deleted file mode 100644 index 55ab72d565..0000000000 --- a/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md +++ /dev/null @@ -1,135 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install Latest Git Version on Ubuntu) -[#]: via: (https://itsfoss.com/install-git-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Install Latest Git Version on Ubuntu -====== - -Installing Git on Ubuntu is very easy. It is available in the [main repository of Ubuntu][1] and you can install it [using the apt command][2] like this: - -``` -sudo apt install git -``` - -Easy? Isn’t it? - -There is only a slight little problem (which might not be a problem at all) and that is the version of [Git][3] it installs. - -On an LTS system, the software stability is of upmost importance this is why Ubuntu 18.04 and other distributions often provide older but stable version of a software that is well tested with the distribution release. - -This is why when you check the Git version, you’ll see that it installs a version which is older than the [current Git version available on Git project’s website][4]: - -``` -[email protected]:~$ git --version -git version 2.17.1 -``` - -At the time of writing this tutorial, the version available on its website is 2.25. So how do you install the latest Git on Ubuntu then? - -### Install latest Git on Ubuntu-based Linux distributions - -![][5] - -One way would be to [install from source code][6]. That cool, old school method is not everyone’s cup of tea. Thankfully, there is a [PPA available from Ubuntu Git Maintainers team][7] that you can use to easily install the latest stable Git version. - -``` -sudo add-apt-repository ppa:git-core/ppa -sudo apt update -sudo apt install git -``` - -Even if you had installed Git using apt previously, it will get updated to the latest stable version. - -``` -[email protected]:~$ git --version -git version 2.25.0 -``` - -The beauty of [using PPA][8] is that if there is a new stable version of Git released, you’ll get it with the system updates. [Just update Ubuntu][9] to get the latest Git stable version. - -Trivia - -Did you know that Git version control system was created by none other than [Linux creator Linus Torvalds][10]? - -### Configure Git [Recommended for developers] - -If you have installed Git for development purposes, you’ll soon start cloning repos, make your changes and commit your change. - -If you try to commit your code, you may see a ‘Please tell me who you are’ error like this: - -``` -[email protected]:~/compress-pdf$ git commit -m "update readme" - -*** Please tell me who you are. - -Run - - git config --global user.email "[email protected]" - git config --global user.name "Your Name" - -to set your account's default identity. -Omit --global to set the identity only in this repository. - -fatal: unable to auto-detect email address (got '[email protected](none)') -``` - -This is because you haven’t configured Git with your personal information which is mandatory. - -As the error already hints, you can set up global Git configuration like this: - -``` -git config --global user.name "Your Name" -git config --global user.email "[email protected]" -``` - -You can check the Git configuration with this command: - -``` -git config --list -``` - -It should show an output like this: - -``` -[email protected] -user.name=abhishek -``` - -This configuration is stored in ~/.gitconfig file. You may also change it manually to change the configuration. - -* * * - -**In the end…** - -I hope this quick little tutorial helped you to install Git on Ubuntu. With the PPA, you easily get the latest Git version. - -If you have any questions or suggestions, please feel free to ask in the comment section. A quick ‘thank you’ is also welcomed :) - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-git-ubuntu/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/ubuntu-repositories/ -[2]: https://itsfoss.com/apt-command-guide/ -[3]: https://git-scm.com/ -[4]: https://git-scm.com/downloads -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/install_git_ubuntu.png?ssl=1 -[6]: https://itsfoss.com/install-software-from-source-code/ -[7]: https://launchpad.net/~git-core/+archive/ubuntu/ppa -[8]: https://itsfoss.com/ppa-guide/ -[9]: https://itsfoss.com/update-ubuntu/ -[10]: https://itsfoss.com/linus-torvalds-facts/ diff --git a/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md b/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md new file mode 100644 index 0000000000..b6b240dadc --- /dev/null +++ b/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Latest Git Version on Ubuntu) +[#]: via: (https://itsfoss.com/install-git-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 上安装最新版本的 Git +====== + +在 Ubuntu 上安装 Git 非常容易。它存在于 [Ubuntu 的主仓库][1]中,你可以像这样[使用 apt 命令][2]安装它: + +``` +sudo apt install git +``` + +很简单?是不是? + +只有一点点小问题(这可能根本不是问题),就是它安装的 [Git][3] 版本。 + +在 LTS 系统上,软件稳定性至关重要,这就是为什么 Ubuntu 18.04 和其他发行版经常提供较旧但稳定的软件版本的原因,它们都经过发行版的良好测试。 + +这就是为什么当你检查 Git 版本时,会看到安装的版本会比 [Git 网站上当前最新 Git 版本][4]旧: + +``` +[email protected]:~$ git --version +git version 2.17.1 +``` + +在编写本教程时,网站上提供的版本为 2.25。那么,如何在 Ubuntu 上安装最新的 Git? + +### 在基于 Ubuntu 的 Linux 发行版上安装最新的 Git + +![][5] + +一种方法是[从源代码安装][6]。这种很酷又老派的方法不适合所有人。值得庆幸的是,Ubuntu Git 维护团队提供了 [PPA][7],莫可以使用它轻松地安装最新的稳定 Git 版本。 + +``` +sudo add-apt-repository ppa:git-core/ppa +sudo apt update +sudo apt install git +``` + +即使你以前使用 apt 安装了 Git,它也将更新为最新的稳定版本。 + +``` +[email protected]:~$ git --version +git version 2.25.0 +``` + +[使用PPA][8] 的好处在于,如果发布了新的 Git 稳定版本,那么就可以通过系统更新获得它。[仅更新 Ubuntu][9]来获取最新的 Git 稳定版本。 + +### 配置Git (推荐给开发者) + +如果你出于开发目的安装了 Git,你会很快开始克隆仓库,进行更改并提交更改。 + +如果你尝试提交代码,那么你可能会看到 “Please tell me who you are” 这样的错误: + +``` +[email protected]:~/compress-pdf$ git commit -m "update readme" + +*** Please tell me who you are. + +Run + + git config --global user.email "[email protected]" + git config --global user.name "Your Name" + +to set your account's default identity. +Omit --global to set the identity only in this repository. + +fatal: unable to auto-detect email address (got '[email protected](none)') +``` + +这是因为你还没配置必要的个人信息。 + +正如错误已经暗示的那样,你可以像这样设置全局 Git 配置: + +``` +git config --global user.name "Your Name" +git config --global user.email "[email protected]" +``` + +你可以使用以下命令检查 Git 配置: + +``` +git config --list +``` + +它应该显示如下输出: + +``` +[email protected] +user.name=abhishek +``` + +配置保存在 \~/.gitconfig 中。你可以手动修改配置。 + +* * * + +**结尾** + +我希望这个小教程可以帮助你在 Ubuntu 上安装 Git。使用 PPA,你可以轻松获得最新的 Git 版本。 + +如果你有任何疑问或建议,请随时在评论部分提问。也欢迎直接写“谢谢” :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-git-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-repositories/ +[2]: https://itsfoss.com/apt-command-guide/ +[3]: https://git-scm.com/ +[4]: https://git-scm.com/downloads +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/install_git_ubuntu.png?ssl=1 +[6]: https://itsfoss.com/install-software-from-source-code/ +[7]: https://launchpad.net/~git-core/+archive/ubuntu/ppa +[8]: https://itsfoss.com/ppa-guide/ +[9]: https://itsfoss.com/update-ubuntu/ \ No newline at end of file