Software Requirements:
1. Both windowsXP and win7 have passed the test
2.Copssh_3.1.4_Installer.exe
3.Git-1.7.3.1-preview20101002.exe
Steps to build a git server:
1. Install copssh
1.1 I choose the installation path c:\ICW, and all other options are selected by default.
1.2 Set the environment variable, add C:\ICW\bin to the Path of the system
1.3 Right-click My Computer, select Manage, open System Tools -> Local Users and Groups -> Users, right-click in the user window, select New User, enter git for the user name, and enter git for the password.
1.4. Select the git user, right-click and select Properties, and click Belong to -> Add, so that the git user is added to the administrator group and has administrator privileges.
1.5 Select Start->All Programs->copssh->0.1 activate a user, select the newly created git user in the user name drop-down list, click next, enter Type a passhrase, and remember the entered Type a passhrase, click activate.
2. Install git
2.1 I choose the installation path c:\git, and all other options are selected by default.
2.2 Set the environment variable, add C:\git\bin to the Path of the system
3. Check the settings
3.1 Open a cmd, enter ssh [email protected], enter the password according to the prompt, (I set git above), remote login appears, git user ssh login successfully
3.2 After successful login, you can use ls, cd, rm, chmod and other commands, but you cannot use git commands, that is, you cannot use ssh protocol to manage git warehouses.
4. Set up git repository management using ssh protocol
4.1 Start -> CopSSH > Start a unix bash shell. (under git user, non-Administrator user)
4.2 cd / Bin
4.3 Create 4 symbolic links pointing to git.exe, git-receive-pack.exe, git-upload-archive.exe, git-upload-pack.exe:
$ ln -s /cygdrive/c/git/bin/git.exe git.exe $ ln -s /cygdrive/c/git/libexec/git-core/git-receive-pack.exe git-receive-pack.exe $ ln -s /cygdrive/c/git/libexec/git-core/git-upload-archive.exe git-upload-archive.exe $ ln -s /cygdrive/c/git/libexec/git-core/git-upload-pack.exe git-upload-pack.exe
4.4 Exit the git account, open a cmd, enter ssh [email protected], log in again, after successful login, enter the git command, the help of the git command will appear.
Or directly open a cmd and enter git, and the help of the git command will also appear, indicating that the git command can be used normally.
4.5 Start a cmd, enter the C:\ICW\var directory, and execute in sequence
mkdir test
cd test
git init
touch a b
git add .
git config --global user.name "jackylee" //Used to add submission user information
git config --global user.email "[email protected]"//Used to add user submission information
git commit -m "first commit"
Use git show to see submitted information and user information
4.5 Start a cmd, I am going to copy the test warehouse managed by the server to e:\, so enter cd e:\ to execute the copy
git clone [email protected]:../../var/test test (the path is a relative path, relative to the c:\ICW\home\git directory after the git account is logged in)
4.6 Copy complete. cmd output.
Cloning into test...
[email protected]'s password:
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
4.7 Create git account information to distinguish which account submitted what content when submitting.
Log in to the git account, enter pwd, and the output is /home/git,
enter
touch .gitconfig
echo "[user]" > .gitconfig
echo "name=jackylee" >> .gitconfig
echo "[email protected]" >> .gitconfig
Creating other accounts is the same as creating a git account
5 Let git manage files in other paths. For example, let git manage the e:\project directory
Start cmd and enter e:\project
Enter in order
git init
git add .
git commit -m "first commit"
Start a cmd and enter C:\ICW\var
Enter in order
ln -s e:\project project
Now you can use git clone to manage the e:\project directory
Enter: git clone [email protected]:../../var/project project_backup
A complete xp git server above has been set up.
Problem Memo:
- if cannot push to remote repo
change the bare = true in \.git\config
if is bare option, cannot checkout
- ssh git@v:..\..\test test
related location
3. c:\git;c:\icw has settings