我可以在不安装的情况下使用git吗?
我听说过有关 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者您可以尝试 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 tochmod +x jgit.sh
)您不能使用
--prefix=/path/to/install/folder/
从源代码编译它,然后make install
将其安装到该文件夹吗?Can't you just compile it from source, using
--prefix=/path/to/install/folder/
and justmake install
it to that folder?