简体   繁体   English

在没有 sudo 权限的情况下安装 Git

[英]Install Git without sudo privilege

I have a non-root account on a Debian 9 (Stretch) System and I want to install Git.我在 Debian 9 (Stretch) 系统上有一个非 root 帐户,我想安装 Git。

Since the account does not have super-user privileges, Git can only be installed locally, as stated here .由于该帐户不具有超级用户的权限,Git的只能在本地安装,如规定在这里

Following the accepted answer, I downloaded and extracted the latest Git version in local home directory (~/) and then I enter the extracted Git folder like按照接受的答案,我在本地主目录 (~/) 中下载并解压缩了最新的 Git 版本,然后输入解压缩的 Git 文件夹,例如

$ cd git-2.33.1/

When I run当我跑

./configure --prefix=~/git-2.33.1/ && make && make install

I get ./configure: No such file or directory .我得到./configure: No such file or directory

Is there anything I can do?有什么我可以做的吗?

I also checked the README of git and when I run make I get fatal error: openssl/ssl.h: No such file or directory #include <openssl/ssl.h>我还检查了 git 的README ,当我运行make时出现fatal error: openssl/ssl.h: No such file or directory #include <openssl/ssl.h>

This will be not very easy to have something working if dependencies are missing.如果缺少依赖项,这将不是很容易让某些东西工作。

What you can do, download the .deb to get the last git version, you can find it https://debian.pkgs.org/11/debian-main-amd64/git_2.30.2-1_amd64.deb.html你可以做什么,下载.deb以获得最新的 git 版本,你可以找到它https://debian.pkgs.org/11/debian-main-amd64/git_2.30.2-1_amd64.deb.html

For example:例如:

cd /tmp
wget http://ftp.br.debian.org/debian/pool/main/g/git/git_2.30.2-1_amd64.deb

Then extract it然后提取出来

mkdir git
cd git
ar x ../git_2.30.2-1_amd64.deb

You will get你会得到

total 5.3M
drwxrwxr-x  2 john doe 4.0K Oct 29 21:31 ./
drwxrwxrwt 29 root      root       16K Oct 29 21:31 ../
-rw-r--r--  1 john doe  16K Oct 29 21:31 control.tar.xz
-rw-r--r--  1 john doe 5.3M Oct 29 21:31 data.tar.xz
-rw-r--r--  1 john doe    4 Oct 29 21:31 debian-binary

Then extract the data part:然后提取数据部分:

tar xvf data.tar.xz

and you get the binaries然后你得到二进制文件

╰┤suze ▶ ls -l usr/bin
total 4968
-rwxr-xr-x 1 john doe 3343280 Mar 10  2021 git*
lrwxrwxrwx 1 john doe       3 Mar 10  2021 git-receive-pack -> git*
-rwxr-xr-x 1 john doe 1733608 Mar 10  2021 git-shell*
lrwxrwxrwx 1 john doe       3 Mar 10  2021 git-upload-archive -> git*
lrwxrwxrwx 1 john doe       3 Mar 10  2021 git-upload-pack -> git*

When I run当我跑

./configure --prefix=~/git-2.33.1/ && make && make install

I get ./configure: No such file or directory.我得到 ./configure: 没有这样的文件或目录。

You don't really need the configure script, but if you want it you can just say make configure and run that, if you're having trouble finding ssl you can ./configure --prefix=$HOME --without-openssl .你真的不需要configure脚本,但如果你想要它,你可以说make configure并运行它,如果你找不到 ssl 你可以./configure --prefix=$HOME --without-openssl

But all that script does is make some easy edits and the Makefile comes preconfigured to install in your home directory and has lots of comments up top explaining how to set yourself up.但是该脚本所做的只是进行一些简单的编辑,并且 Makefile 已预先配置为安装在您的主目录中,并且顶部有很多注释解释了如何设置自己。 For instance,例如,

 # Define NO_OPENSSL environment variable if you do not have OpenSSL.

so you can这样你就可以

tar xf the.downloaded.tar
cd ./git-2.33.1
echo NO_OPENSSL = > config.mak

and you're all set up for你已经准备好了

make install

to build without openssl support and install to $HOME .在没有 openssl 支持的情况下构建并安装到$HOME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM