【Git】2、Linux快速安装Git环境 & oh-my-zsh
Linux快速安装Git环境
搭建Git环境,安装oh-my-zsh主题
简单记录 - 专栏 Git原理详解与实操指南
1、Linux安装Git
Linux安装Git比较简单,不少Linux系统已经自带了Git工具,Linux 是有多个发行版本,但安装Git都非常的简单,例如:
ubuntu 系统的安装命令如下:
apt install git
Centos 系统安装命令如下:
yum -y install git
安装完成之后,要确认是否安装成功,可以在终端当中输入git —version命令,如果可以看到 Git 的版本号,说明已经成功安装:
# git --version
git version 2.17.1
root@DESKTOP-HVI7SH0:/home/liuawen/git# apt install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version (1:2.17.1-1ubuntu0.5).
0 upgraded, 0 newly installed, 0 to remove and 33 not upgraded.
root@DESKTOP-HVI7SH0:/home/liuawen/git# git --version
git version 2.17.1
root@DESKTOP-HVI7SH0:/home/liuawen/git#
2、安装zsh
我想要安装oh-my-zsh主题,那首先要安装zsh
Linux安装zsh也是非常简单的,例如:
Ubuntu 安装 zsh 命令:
apt install zsh
centos 安装 zsh 命令:
yum install zsh
我现在是用得Ubuntu ,执行安装命令之后可以看到返回如下信息:
root@DESKTOP-HVI7SH0:/home/liuawen/git# apt install zsh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
zsh-common
Suggested packages:
zsh-doc
The following NEW packages will be installed:
zsh zsh-common
0 upgraded, 2 newly installed, 0 to remove and 33 not upgraded.
Need to get 4066 kB of archives.
After this operation, 15.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 zsh-common all 5.4.2-3ubuntu3.1 [3376 kB]
Get:2 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 zsh amd64 5.4.2-3ubuntu3.1 [690 kB]
Fetched 4066 kB in 18s (226 kB/s)
Selecting previously unselected package zsh-common.
(Reading database ... 29242 files and directories currently installed.)
Preparing to unpack .../zsh-common_5.4.2-3ubuntu3.1_all.deb ...
Unpacking zsh-common (5.4.2-3ubuntu3.1) ...
Selecting previously unselected package zsh.
Preparing to unpack .../zsh_5.4.2-3ubuntu3.1_amd64.deb ...
Unpacking zsh (5.4.2-3ubuntu3.1) ...
Setting up zsh-common (5.4.2-3ubuntu3.1) ...
Setting up zsh (5.4.2-3ubuntu3.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
3、安装oh-my-zsh
oh-my-zsh 能够使我们在输入一些Git命令时候提供很大的方便。
3.1、安装oh-my-zsh
终端输入命令,安装命令如下:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
执行安装命令完成之后,可以看到终端如下信息:
root@DESKTOP-HVI7SH0:/home/liuawen/git# sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Cloning Oh My Zsh...
Cloning into '/root/.oh-my-zsh'...
remote: Enumerating objects: 1137, done.
remote: Counting objects: 100% (1137/1137), done.
remote: Compressing objects: 100% (1102/1102), done.
remote: Total 1137 (delta 22), reused 923 (delta 17), pack-reused 0
Receiving objects: 100% (1137/1137), 750.61 KiB | 13.00 KiB/s, done.
Resolving deltas: 100% (22/22), done.
Checking out files: 100% (845/845), done.
Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc.
Time to change your default shell to zsh:
Do you want to change your default shell to zsh? [Y/n] y
Changing the shell...
Shell successfully changed to '/usr/bin/zsh'.
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us on https://twitter.com/ohmyzsh
p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh
➜ git git:(master)
3.2、 测试验证
安装成功之后,会看到终端发现明显的变化,
比如当我们输入命令的一部分再按下 tab 键时,它会给你一些相应的提示或者自动补全。
例如输入:
git i
再按下 tab 键,在终端会看到如下效果:
➜ git git:(master)git i
imap-send -- send a collection of patches to an IMAP folder
index-pack -- build pack index file for an existing packed archive
init -- create empty git repository or re-initialize an existing one
instaweb -- instantly browse your working repository in gitweb
除了自动补全和命令提示外,还可以帮助我们纠错,
例如当我们输入命令:
git statsu
它会告诉你 git 没有这个命令,并提示你相对应正确的命令,如下所示:
➜ ~ git statsu
git: 'statsu' is not a git command. See 'git --help'.
The most similar command is
status
4、小结
记录了Linux安装Git,辅助工具oh-my-zsh的安装过程。
ubuntu 系统使用的命令如下:
apt install git
git --version
apt install zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Q:为什么要安装oh-my-zsh
A:oh-my-zsh是zsh的一个主题,支持命令智能提示,能够给我们在输入一些Git命令时候提供很大的方便。
Q:终端重新登录之后,回到了原来默认的shell主题了。
root@DESKTOP-HVI7SH0:/home/liuawen/git# git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
root@DESKTOP-HVI7SH0:/home/liuawen/git# chsh -s /bin/zsh
root@DESKTOP-HVI7SH0:/home/liuawen/git# git init
Reinitialized existing Git repository in /home/liuawen/git/.git/
root@DESKTOP-HVI7SH0:/home/liuawen/git# git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
root@DESKTOP-HVI7SH0:/home/liuawen/git# git --version
git version 2.17.1
root@DESKTOP-HVI7SH0:/home/liuawen/git# chsh -s /bin/zsh
root@DESKTOP-HVI7SH0:/home/liuawen/git# git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
root@DESKTOP-HVI7SH0:/home/liuawen/git#
A:解决方案 执行chsh -s /bin/zsh命令,重新登录。
liuawen@DESKTOP-HVI7SH0:~$ pwd
/home/liuawen
liuawen@DESKTOP-HVI7SH0:~$ cd git
liuawen@DESKTOP-HVI7SH0:~/git$ pwd
/home/liuawen/git
liuawen@DESKTOP-HVI7SH0:~/git$ ls
liuawen@DESKTOP-HVI7SH0:~/git$ git init
error: could not lock config file /home/liuawen/git/.git/config: Permission denied
fatal: could not set 'core.repositoryformatversion' to '0'
liuawen@DESKTOP-HVI7SH0:~/git$ su root
Password:
➜ git git:(master) git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
➜ git git:(master)
【Git】2、Linux快速安装Git环境 & oh-my-zsh的更多相关文章
- linux快速安装lamp环境
我折腾过不少的lamp安装方式,lnmp也折腾过.不过因为windows下面apache用的比较多,各种配置也比较熟悉,因此最终还是选择了lamp这个架构. 由于是自己装虚拟机玩,所以各种安全措施都没 ...
- 环境部署(三):Linux下安装Git
Git是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理,是目前使用范围最广的版本管理工具. 这篇博客,介绍下Linux下安装Git的步骤,仅供参考,当然,还是yum安装 ...
- Linux上安装git
Linux上安装git Git是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理. 而国外的GitHub和国内的Coding都是项目的托管平台.但是在使用Git工具的时候 ...
- git 入门教程之安装 git
安装 git git 目前支持 Linux/Unix.Solaris.Mac和 Windows 平台上运行,根据自身环境选择安装. Linux 系统 linux 系统安装软件大致有两种途径,一种是利用 ...
- Java java jdk在Linux下安装与环境变量的配置
java jdk在Linux下安装与环境变量的配置 by:授客 QQ:1033553122 linux环境:CentOS-6.0-x86_64-bin-DVD1.iso [root@localhost ...
- Linux CentOS安装PHP环境
Linux CentOS安装PHP环境 1.下载php环境 wget http://cn2.php.net/distributions/php-7.2.1.tar.gz 更多php版本下载 http ...
- Linux下安装php环境并且配置Nginx支持php-fpm模块[www]
Linux下安装php环境并且配置Nginx支持php-fpm模块 http://www.cnblogs.com/freeweb/p/5425554.html 5分钟搭建 nginx +php --- ...
- Linux下安装Java环境配置
1.下载安装文件 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 2. ...
- Linux一键安装web环境全攻略phpstudy版
此教程主要是应对阿里云Linux云服务器ecs的web环境安装,理论上不限于阿里云服务器,此教程对所有Linux云服务器都具有参考价值. 写这篇文章的目的:网上有很多关于Linux一键安装web环境全 ...
随机推荐
- vue+ springboot 分页(两种方式:sql分页 & PageHelper 分页)
方法一:sql分页 思路:使用数据库进行分页 前端使用element-ui的分页组件,往后台传第几页的起始行offest 以及每页多少行pageSize,后台根据起始行数和每页的行数可以算出该页的 ...
- K8s 终将废弃 docker,TKE 早已支持 containerd
近日 K8s 官方称最早将在 1.23版本弃用 docker 作为容器运行时,并在博客中强调可以使用如 containerd 等 CRI 运行时来代替 docker.本文会做详细解读,并介绍 dock ...
- ssh-copy-id三步实现SSH免密登录
背景 在日常工作中,不希望每次登录都输入密码,这里主要介绍一种简单的配置Linux主机间免密登录的方式 先了解两个核心命令: ssh-keygen :产生公钥和私钥对 ssh-copy-id:将北极的 ...
- IOS开发中实现UITableView按照首字母将集合进行检索分组
在开发公司项目中遇到了将图书目录进行按照首字母分组排序的问题 1.在项目添加解析汉字拼音的Pinyin.h文件 /* * pinyin.c */ #define HANZI_START 19968 # ...
- 抢先看:笔者亲历的2020年中国.NET开发者大会活动纪实
2020年中国.NET开发者大会活动纪实 1 2020年12月19日的苏州工业园区,天公作美,阳光明媚,气象迷人,正是一个搞事的好日子.在这里,数百名中国.NET开发者们汇聚一堂,怀揣着激情和梦想,一 ...
- CCNP第二天之复习CCNA
1.静态路由的扩展配置: (1).环回接口: 在设备上用于测试TCP/IP协议栈能否正常使用.默认没有.需要手工创建 R1(config)#interface loopback 1 ...
- VS2019开启调试,测试图片上传的时候,一点到图片上传,直接导致VS调试崩掉,返回 程序“[14764] iisexpress.exe”已退出,返回值为 -1 (0xffffffff)。 是什么原因导致的?
试着使用管理员身份运行vs 今天调试的时候遇到个奇葩问题 一点上传控件选择文件后 就终止调试 发现根源不在上传控件 而是本地的中文输入法!关掉vs自动终止调试设置就好了 工具->选项-> ...
- 如何使用iis发布多个ftp,为何ftp 503错误?
使用iis做网站时,需要每个网站都是80端口,所以用到了域名,为了方便发布应用,故将所有网站均添加了ftp发布,当我添加ftp域名绑定后,发现根本无法登陆ftp服务器,后经过百度+博客发现,解决方案: ...
- WEB层知识点
目录 Web 应用程序技术 HTTP 1.1 HTTP请求 1.2 HTTP响应 1.3 HTTP方法 1.4 URL 1.5 HTTP消息头 1.常用消息头 2.请求消息头 3.响应消息头 1.7 ...
- java中文上传下载功能实现(自己测试项目)
1.新建maven项目打war包 2.搭建springMVC框架 web.xml文件配置 <?xml version="1.0" encoding="UTF-8&q ...