Git - 如何验证在Ubuntu上安装Git的方式
我是Ubuntu和Git的新手。我如何验证我在我的机器上安装了git?当我尝试apt-get时,得到:Git - 如何验证在Ubuntu上安装Git的方式
[email protected]:/home/nebojsa# apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-3.13.0-24 linux-headers-3.13.0-24-generic
linux-headers-3.13.0-39 linux-headers-3.13.0-39-generic
linux-headers-3.13.0-40 linux-headers-3.13.0-40-generic
linux-headers-3.13.0-43 linux-headers-3.13.0-43-generic
linux-image-3.13.0-24-generic linux-image-3.13.0-39-generic
linux-image-3.13.0-40-generic linux-image-3.13.0-43-generic
linux-image-extra-3.13.0-24-generic linux-image-extra-3.13.0-39-generic
linux-image-extra-3.13.0-40-generic linux-image-extra-3.13.0-43-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 133 not upgraded.
但我不知道软件包安装在哪里。
感谢您的帮助!
只要打电话给git --version
:应该如果你想看到更多细节的路径返回可执行
。它应该返回是这样的:
$ git --version
git version 1.9.3 (Apple Git-50)
它会告诉你
git is already the newest version.
所以一切都应该没问题。
提示:看到一个软件包安装文件,运行
dpkg -L git
它会列出很多文件,但最重要的是/usr/bin/git
。另一个命令which git
在运行git
时返回正在运行的文件 - 它应该是相同的。
如果您正在运行bash,'type git'更可靠。它内置在shell中,因此可以显示别名和函数定义。 – 2015-03-02 21:08:38
与大多数可执行文件一样,git
安装在/usr/bin/git
中。
要看到所有可在git
包所在的一部分的文件,您可以键入:
dpkg -L git
你会通过less
或你喜欢的网页希望通过管道输出;我在我的系统上得到了 664行输出。
(并非所有的系统使用的是Ubuntu的做同样的包管理器,你可能需要使用一些命令比dpkg
其他,也许rpm
,yum
或dnf
。)
如果您已经从源代码,而不是通过安装的git包管理器,git
可执行文件可能在任何地方,这取决于你如何安装它。如果它在你的$PATH
,打字
type git
或
type -a git
会告诉你它在哪里。 (假设你使用的是默认的bash shell。)
是的,安装git。至于你对软件包位置的问题,这对你来说很可能是无关紧要的。如果你发现自己正在浏览一个linux文件系统来执行一个已经安装在系统范围内的程序,那么一切都会关闭。你通常不需要这样做。
至于git,打开终端并键入'git'会给你的基本知识。更多的可以阅读输入“man git”(man命令可以很好地查找包中的其他信息)。
如果你想有一个图形前端的混帐,看到这个https://askubuntu.com/questions/227554/what-are-some-gui-clients-for-git
which git
是使用命令,这给其中,如果已经安装了安装git的位置,通常/usr/bin/git
。如果混帐ISN” t安装你不会得到任何东西。
你在问两个不同的问题:如何验证'git'是否已安装,以及*其中*是否已安装。 – 2015-03-02 21:26:38