我可以在不安装的情况下使用git吗?

发布于 2024-11-05 14:42:37 字数 1242 浏览 1 评论 0原文

我听说过有关 git 的好消息,我想在安装它之前尝试一下。如果我想在学校使用 git,那么将它放在闪存驱动器上也很棒。是否可以使用像 /path/to/git init 这样的完整路径?

我主要使用 Mac OS X,所以问题主要针对 Mac,但我也想知道在其他操作系统上是否也可以。

编辑:

从源代码编译。我使用了以下命令:

cd git-1.7.5.1 #this is the decompressed dir containing src
make configure
./configure --prefix=/path/to/install/git
make all
sudo make install

这种方法的缺点是一旦编译,该目录就会有 200MB 之大。 这就是为什么我选择 jgit 作为答案。 jgit.sh 小于 2MB,支持以下命令:

add       Add file contents to the index
branch    List, create, or delete branches
checkout  Checkout a branch to the working tree
clone     Clone a repository into a new directory
commit    Record changes to the repository
daemon    Export repositories over git://
diff      Show diffs
fetch     Update remote refs from another repository
init      Create an empty git repository
log       View commit history
merge     Merges two development histories
push      Update remote repository from local refs
rm        Stop tracking a file
tag       Create a tag
version   Display the version of jgit

您可以在此处下载 jgit.sh http://www.eclipse.org/jgit/download/

I have heard good things about git and I would like to try it out before installing it. This would also be great to put it on a flash drive if I wanted to use git at school. Is it possible to use the full path like /path/to/git init?

I primarily use Mac OS X so the question is mostly directed for Mac, but I would also like to know if it is possible on other OS's as well.

EDIT:

Compiling from source works. I used the following commands:

cd git-1.7.5.1 #this is the decompressed dir containing src
make configure
./configure --prefix=/path/to/install/git
make all
sudo make install

The downside to this method is that once compiled, the directory is a hefty 200MB.
That is why I chose jgit as the answer. jgit.sh is less than 2MB and supports the following commands:

add       Add file contents to the index
branch    List, create, or delete branches
checkout  Checkout a branch to the working tree
clone     Clone a repository into a new directory
commit    Record changes to the repository
daemon    Export repositories over git://
diff      Show diffs
fetch     Update remote refs from another repository
init      Create an empty git repository
log       View commit history
merge     Merges two development histories
push      Update remote repository from local refs
rm        Stop tracking a file
tag       Create a tag
version   Display the version of jgit

You can download jgit.sh here http://www.eclipse.org/jgit/download/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

GRAY°灰色天空 2024-11-12 14:42:37

或者您可以尝试 JGit,它是一个可以运行基本 Git 命令的 bash 文件。 Git 自包含在该 bash 脚本中。

要下载 JGit,请选择位于此处的第二个链接(自包含命令行可执行文件)http://www.eclipse.org/jgit/ download/ 下载后,将其重命名为 jgit.sh 并运行它:jgit.sh(记住 chmod +x jgit.sh

Or you can try out JGit, it is a single bash file that you can run basic Git commands. Git is self contained in that bash script.

To download JGit, choose the second link (Self contained command line executable) located here http://www.eclipse.org/jgit/download/ once downloaded, rename it to jgit.sh and just run it: jgit.sh (remember to chmod +x jgit.sh)

飘逸的'云 2024-11-12 14:42:37

您不能使用 --prefix=/path/to/install/folder/ 从源代码编译它,然后 make install 将其安装到该文件夹​​吗?

Can't you just compile it from source, using --prefix=/path/to/install/folder/ and just make install it to that folder?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文