Skip to content

Commit bde235f

Browse files
committed
The Real Portable Git™
1 parent ee436a2 commit bde235f

File tree

5,130 files changed

+1723184
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,130 files changed

+1723184
-1
lines changed

assets/Git-2.5.1-32-bit.exe

-29.2 MB
Binary file not shown.

assets/PortableGit/README.portable

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
README.portable
2+
=======================
3+
4+
This version of Git for Windows is portable, i.e. does not need to
5+
be installed. It will run from any directory you place it in, even
6+
from a USB thumbdrive. It will not write permanent entries into the
7+
Windows registry. It does not need administrator privileges to "install".
8+
9+
10+
Installation
11+
------------
12+
13+
This package is contained in a 7-zip archive with a file name of the form
14+
'PortableGit-<versionstring>.7z.exe'. It is a self-extracting archive:
15+
you can (double-)click it and it will ask for the desired target directory
16+
(which defaults to C:\Program Files\Git). You may change that as needed or
17+
desired. Your user account needs write access to the selected directory.
18+
(You can move that directory with all its contents to a different place or
19+
computer at any time should you later desire so).
20+
21+
22+
Functional differences to the non-portable Git for Windows
23+
----------------------------------------------------------
24+
25+
This version does not offer you the convenient right-click context menu
26+
entries "Git GUI Here" and "Git Bash Here", because these would require
27+
to add entries into the Windows registry.
28+
29+
30+
Warning
31+
-------
32+
33+
Since this portable package does not modify any Windows %path%
34+
variables, it is not possible to run the git.exe and gitk.exe files
35+
directly. Start the Git Bash or Git Cmd instead, or add the cmd/ folder
36+
to your %path%.
37+
38+
39+
How to start using PortableGit
40+
------------------------------
41+
42+
If you are comfortable with a Unix-like shell, just launch 'git-bash.exe'.
43+
44+
If not, just launch 'git-cmd.exe'.
45+
46+
Alternatively, you can execute these commands to modify the %path%
47+
variable temporarily:
48+
49+
set gitdir=c:\portablegit
50+
set path=%gitdir%\cmd;%path%
51+
52+
Adjust the 'gitdir' according to your setup. As long as you do not
53+
close the command window, you can now simply type "git" or "gitk" to
54+
really call "c:\portablegit\cmd\git.cmd" or "c:\portablegit\cmd\gitk.cmd".
55+
56+
By default, git-cmd and git-bash use the directory they were started from as
57+
the working directory when run. You can override this by passing --cd-to-home
58+
to them, which will set the user's home directory as the working directory (as
59+
if Git for Windows was installed).
60+
61+
In addition, if you set the HOME environment variable (either permanently or
62+
for the current session only) you can make Git store the configuration files
63+
and the cloned repositories in the directory specified in that variable. And if
64+
you specify --cd-to-home, git-bash and git-cmd will use that as the
65+
working directory, too. For example:
66+
67+
set HOME=%cd%/home
68+
git --cd-to-home
69+
will use the relative directory named home (%cd% specifies the current
70+
directory).
71+
72+
Quick start
73+
-----------
74+
75+
Start configuring git with your personal settings:
76+
git config --global user.name "Joe Sixpack"
77+
git config --global user.email joe.sixpack@g_mail.com
78+
79+
Start using git:
80+
git --help
81+
82+
83+
How to change %path% permanently
84+
--------------------------------
85+
86+
You may also want to make the modification to the %path% variable a
87+
permanent one. The %path% variable may be changed:
88+
89+
* either on a System level (for all users in the lower pane), if you are
90+
an Administrator
91+
* or for your own user account only (in the upper pane).
92+
93+
To change the %path% variable permanently:
94+
95+
* right-click "My Computer",
96+
* select "Properties",
97+
* open "Advanced",
98+
* click "Environment Variables",
99+
* highlight the "Path" variable,
100+
* click "Edit" (either in upper or in lower pane),
101+
* add your specific path to front of "Variable value" field, separated
102+
by a semicolon from the existing entry.
103+

assets/PortableGit/bin/bash.exe

29.5 KB
Binary file not shown.

assets/PortableGit/bin/git.exe

135 KB
Binary file not shown.

assets/PortableGit/bin/sh.exe

29.5 KB
Binary file not shown.

assets/PortableGit/cmd/git-gui.exe

135 KB
Binary file not shown.

assets/PortableGit/cmd/git.exe

135 KB
Binary file not shown.

assets/PortableGit/cmd/gitk.exe

135 KB
Binary file not shown.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
@REM Do not use "echo off" to not affect any child calls.
2+
3+
@REM Enable extensions, the `verify` call is a trick from the setlocal help
4+
@VERIFY other 2>nul
5+
@SETLOCAL EnableDelayedExpansion
6+
@IF ERRORLEVEL 1 (
7+
@ECHO Unable to enable extensions
8+
@GOTO failure
9+
)
10+
11+
@REM Start the ssh-agent if needed by git
12+
@FOR %%i IN ("git.exe") DO @SET GIT=%%~$PATH:i
13+
@IF EXIST "%GIT%" @(
14+
@REM Get the ssh-agent executable
15+
@FOR %%i IN ("ssh-agent.exe") DO @SET SSH_AGENT=%%~$PATH:i
16+
@IF NOT EXIST "%SSH_AGENT%" @(
17+
@FOR %%s IN ("%GIT%") DO @SET GIT_DIR=%%~dps
18+
@FOR %%s IN ("!GIT_DIR!") DO @SET GIT_DIR=!GIT_DIR:~0,-1!
19+
@FOR %%s IN ("!GIT_DIR!") DO @SET GIT_ROOT=%%~dps
20+
@FOR %%s IN ("!GIT_ROOT!") DO @SET GIT_ROOT=!GIT_ROOT:~0,-1!
21+
@FOR /D %%s in ("!GIT_ROOT!\usr\bin\ssh-agent.exe") DO @SET SSH_AGENT=%%~s
22+
@IF NOT EXIST "!SSH_AGENT!" @GOTO ssh-agent-done
23+
)
24+
@REM Get the ssh-add executable
25+
@FOR %%s IN ("!SSH_AGENT!") DO @SET BIN_DIR=%%~dps
26+
@FOR %%s in ("!BIN_DIR!") DO @SET BIN_DIR=!BIN_DIR:~0,-1!
27+
@FOR /D %%s in ("!BIN_DIR!\ssh-add.exe") DO @SET SSH_ADD=%%~s
28+
@IF NOT EXIST "!SSH_ADD!" @GOTO ssh-agent-done
29+
@REM Check if the agent is running
30+
@FOR /f "tokens=1-2" %%a IN ('tasklist /fi "imagename eq ssh-agent.exe"') DO @(
31+
@ECHO %%b | @FINDSTR /r /c:"[0-9][0-9]*" > NUL
32+
@IF "!ERRORLEVEL!" == "0" @(
33+
@SET SSH_AGENT_PID=%%b
34+
) else @(
35+
@REM Unset in the case a user kills the agent while a session is open
36+
@REM needed to remove the old files and prevent a false message
37+
@SET SSH_AGENT_PID=
38+
)
39+
)
40+
@REM Connect up the current ssh-agent
41+
@IF [!SSH_AGENT_PID!] == [] @(
42+
@ECHO Removing old ssh-agent sockets
43+
@FOR /d %%d IN (%TEMP%\ssh-??????*) DO @RMDIR /s /q %%d
44+
) ELSE @(
45+
@ECHO Found ssh-agent at !SSH_AGENT_PID!
46+
@FOR /d %%d IN (%TEMP%\ssh-??????*) DO @(
47+
@FOR %%f IN (%%d\agent.*) DO @(
48+
@SET SSH_AUTH_SOCK=%%f
49+
@SET SSH_AUTH_SOCK=!SSH_AUTH_SOCK:%TEMP%=/tmp!
50+
@SET SSH_AUTH_SOCK=!SSH_AUTH_SOCK:\=/!
51+
)
52+
)
53+
@IF NOT [!SSH_AUTH_SOCK!] == [] @(
54+
@ECHO Found ssh-agent socket at !SSH_AUTH_SOCK!
55+
) ELSE (
56+
@ECHO Failed to find ssh-agent socket
57+
@SET SSH_AGENT_PID=
58+
)
59+
)
60+
@REM See if we have the key
61+
@SET "HOME=%USERPROFILE%"
62+
@"!SSH_ADD!" -l 1>NUL 2>NUL
63+
@SET result=!ERRORLEVEL!
64+
@IF NOT !result! == 0 @(
65+
@IF !result! == 2 @(
66+
@ECHO | @SET /p=Starting ssh-agent:
67+
@FOR /f "tokens=1-2 delims==;" %%a IN ('"!SSH_AGENT!"') DO @(
68+
@IF NOT [%%b] == [] @SET %%a=%%b
69+
)
70+
@ECHO. done
71+
)
72+
@"!SSH_ADD!"
73+
@ECHO.
74+
)
75+
)
76+
77+
:ssh-agent-done
78+
:failure
79+
80+
@ENDLOCAL & @SET "SSH_AUTH_SOCK=%SSH_AUTH_SOCK%" ^
81+
& @SET "SSH_AGENT_PID=%SSH_AGENT_PID%"
82+
83+
@ECHO %cmdcmdline% | @FINDSTR /l "\"\"" >NUL
84+
@IF NOT ERRORLEVEL 1 @(
85+
@CALL cmd %*
86+
)

assets/PortableGit/dev/fd

40 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)