1. GitBit server construction
1. Download
Download link: http://www.gitblit.com/
2. Installation
Unzip the downloaded compressed package
3. Modify the configuration
Open the gitblit.properties
file under the data path and fill in the basic configuration information
# 定义资源库文件目录
git.repositoriesFolder = F:\2_DevOps\gitrepositories
# 修改http协议端口
server.httpPort = 8089
# 修改服务器地址绑定
server.httpBindInterface = 172.16.63.13
4. Start
Double click on the root directory gitbit.cmd
to start
5. Visit the homepage
Enter the configured address and port to open the gitbit homepage.
6. Set to start Gitblit as a Windows Service
① In the Gitblit directory, find the installService.cmd file.
②Modify ARCH
32-bit system: SET ARCH=x86
64-bit system: SET ARCH=amd64 ③Add
CD as the program directory
SET CD=D:\Git\Gitblit-1.6.0 (your actual directory)
④Modify the startup parameters in StartParams and leave it blank.
7. Start Gitblit as a Windows Service.
-
Double-click the installService.cmd file in the Gitblit directory (run as an administrator).
-
Under the server's service management, you can see the existing gitblit service.
-
In normal use, it is enough to keep this service active.
Second, use Gitbit
1. Log in
The default administrator login password for Gitbit isadmin
2. Create a repository
1️⃣New repository
2️⃣Select the relevant configuration of the repository
- Fill in the name and description, pay attention to the name must add .git at the end
- Choose to restrict viewing, cloning and pushing
- Check "Add README" and "Add .gitignore file"
- At the end, select the programming language you build the repository, such as Java
- Finally, click "Create"
- After the creation is successful, enter the corresponding version library, the following interface will be displayed
- Click "Directory" to view the files in the version library
3. Create a new user
①. Click User >> Add User
②. Fill in the user's information, and the options in the red box may be checked according to the situation, and may not be checked; then click Save.
③ After the addition is successful, the corresponding user information will be displayed in the list
4. Log in to the newly added user at this time, and you can see that there is no repository information on the interface. This is because there is currently no repository authority:
5. Grant the user read and write permissions to the repository
Switch the administrator account, and enter the corresponding version library, click edit
and then click "permissions", select the user and permissions you want (permissions can be selected "RW (push)"); finally click "Add"
after successful addition, click "Save"
At this time, switch back to the previous user, and you can see the version library information on the interface.
6. The client connects, clones and downloads the repository code of the GitBlit server
Locally, git clone down, put the project into the repository, and upload it with the git command
git add .
git commit -m '初始化项目'
git push orgin master
Specific steps:
1️⃣ Use the newly created username and password to log in, GitBlit server, copy the URL in the red box
2️⃣ Open idea, select Git and
paste the previously entered URL into the URL, click Test, and you will be prompted to enter the password. If the connection is successful, You will be prompted Connection successful
. After clicking Clone to
open the project, you will see two files ".gitignore" and "README.md" in the repository. These two files were added when we created the repository. If these two files exist , Indicating that the cloning was successful.
7. Submit the code
Refer to the introduction after step 7 of the idea integrated GitHub environment for operation.
Third, the definition of permissions
1. Gitblit version library permission definition:
- V can use the browser to view, subscribe to RSS, zip package download
- R has all the permissions of V, and also has the permission to copy (clone) remote warehouses to the local
- RW has all the permissions of R and also has the permission to push to the remote warehouse
- RWC has all the permissions of RW, and also has the permission to create remote branches
- RWD has all the permissions of RWC, and also has the permission to delete remote branches
- RW+ has all the permissions of RWD, and also has the permission to roll back remote branches
2. Gitblit management permissions:
- admin super administrator: has all permissions (this is no doubt)
- owner: can create, edit, rename, delete, fork personal warehouse
- Certified users can create personal warehouses and fork personal warehouses