温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Ubuntu中Git常用命令有哪些

发布时间:2021-12-16 13:46:41 来源:亿速云 阅读:163 作者:小新 栏目:互联网科技

这篇文章主要为大家展示了“Ubuntu中Git常用命令有哪些”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Ubuntu中Git常用命令有哪些”这篇文章吧。

1、安装

基于Ubuntu系统,git安装命令如下:

## 安装最小依赖性的主要组件apt-get install git或## 安装包含所有sub-packagesapt-get install git-all

2、查看版本信息

root@ubuntu:/home/run# git --versiongit version 2.17.1

3、配置用户信息

## 配置用户名,例:rungit config --global user.name run## 配置邮箱,例:run@263.comgit config --global user.email run@263.com## 配置文本编辑器,例:vimgit config --global core.editor vim## 配置git着色git config --global color.ui auto## 查看某个配置信息,例:user.emailgit config user.email## 查看配置信息git config --list## 查看配置信息及所在文件git config --list --show-origin

例:

## 查看配置信息及所在文件root@ubuntu:/home/run/code/rockchip-bsp# git config --list --show-originfile:/root/.gitconfig   user.email=run@263.comfile:/root/.gitconfig   user.name=runfile:/root/.gitconfig   color.ui=autofile:/root/.gitconfig   core.editor=vimfile:.git/config        core.repositoryformatversion=0file:.git/config        core.filemode=truefile:.git/config        core.bare=falsefile:.git/config        core.logallrefupdates=truefile:.git/config        submodule.active=.file:.git/config        remote.origin.url=https://github.com/radxa/rockchip-bsp.gitfile:.git/config        remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*file:.git/config        branch.master.remote=originfile:.git/config        branch.master.merge=refs/heads/masterfile:.git/config        submodule.build.url=https://github.com/radxa/build.gitfile:.git/config        submodule.kernel.url=https://github.com/radxa/kernel.gitfile:.git/config        submodule.rkbin.url=https://github.com/radxa/rkbin.gitfile:.git/config        submodule.rootfs.url=https://github.com/radxa/rk-rootfs-build.gitfile:.git/config        submodule.u-boot.url=https://github.com/radxa/u-boot.git## 查看配置文件root@ubuntu:/home/run/code/rockchip-bsp# cat ~/.gitconfig[user]        email = run@263.com        name = run[color]        ui = auto[core]        editor = vim

注:

1、git config -h查看其他参数。

2、--global对应的配置文件:~/.gitconfig,只需要运行一次,针对当前用户。

3、本地仓库的git配置文件:.git/config

4、如果针对某个git仓库配置,可以省略--global或者替换为--local参数。

5、每次git提交都会用到nameemail等信息。

以上是“Ubuntu中Git常用命令有哪些”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI