软件&&Git的使用
程序员文章站
2024-01-24 19:50:10
...
软件&&Git的使用
安装windows版Git服务
- 下载、安装Git服务
下载地址:
- 安装完成后如下图所示
创建公私**
上传公私**到Git服务并赋予Git权限
如何使用公私**git clone数据?
将拥有Git权限的公私**放置在“C:\Users\Administrator.ssh”目录下,如下图所示
切换到Git项目存放目录下,右键选择"Git Bash Here",如下图所示。
执行git clone命令从Git服务器克隆项目到本地
$ git clone aaa@qq.com:gitolite-admin
Cloning into 'gitolite-admin'...
remote: Counting objects: 486, done.
remote: Compressing objects: 100% (419/419), done.
remote: Total 486 (delta 162), reused 0 (delta 0)
Receiving objects: 100% (486/486), 79.85 KiB | 654.00 KiB/s, done.
Resolving deltas: 100% (162/162), done.
如何为新用户或公私**添加Git权限
配置gitolite.conf文件将新用户添加到对应的Git权限组并push生效
登录Git服务器,将公钥上传并配置文件另公钥生效
Git如何添加新项目到Git服务器?
获取Git权限控制文件
#在当前客户端提前放置好公私**,然后使用git clone命令从Git服务器获取Git权限控制文件
$ git clone aaa@qq.com:gitolite-admin
Cloning into 'gitolite-admin'...
remote: Counting objects: 486, done.
remote: Compressing objects: 100% (419/419), done.
remote: Total 486 (delta 162), reused 0 (delta 0)
Receiving objects: 100% (486/486), 79.85 KiB | 654.00 KiB/s, done.
Resolving deltas: 100% (162/162), done.
配置gitolite.conf文件并push上传生效
#进入Git权限控制文件根目录
aaa@qq.com MINGW64 /d/gitPlace
$ cd gitolite-admin/
#配置conf/gitolite.conf文件并增加以下两行。"repo 新项目名称"和"RW+ = @权限组名称"
aaa@qq.com MINGW64 /d/gitPlace/gitolite-admin (master)
$ vim conf/gitolite.conf
repo InterMCU_4.1
RW+ = @pc
#添加更新后的文件到缓冲区
aaa@qq.com MINGW64 /d/gitPlace/gitolite-admin (master)
$ git add conf/
#对本地操作内容做具体描述
aaa@qq.com MINGW64 /d/gitPlace/gitolite-admin (master)
$ git commit -m "add repository InterMCU_4.1"
[master 6582a65] add repository InterMCU_4.1
1 file changed, 3 insertions(+)
#更新配置文件到Git服务器,服务器将初始化一个空的仓库InterMCU_4.1
aaa@qq.com MINGW64 /d/gitPlace/gitolite-admin (master)
$ git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 380 bytes | 190.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: Initialized empty Git repository in /home/git/repositories/InterMCU_4.1.git/
To 112.112.112.112:gitolite-admin
646e3bb..6582a65 master -> master
配置文件修改部分如下图所示。
初始化并提交本地Git仓库到Git服务器
#进入新项目目录
aaa@qq.com MINGW64 /d/gitPlace/InterMCU_4.1
$ ls -alh
total 4.0K
drwxr-xr-x 1 Administrator 197121 0 10月 17 12:29 ./
drwxr-xr-x 1 Administrator 197121 0 10月 17 13:04 ../
drwxr-xr-x 1 Administrator 197121 0 10月 17 12:28 extras/
#初始化当前目录作为git本地仓库
aaa@qq.com MINGW64 /d/gitPlace/InterMCU_4.1
$ git init
Initialized empty Git repository in D:/gitPlace/InterMCU_4.1/.git/
#初始化成功后,当前目录会出现一个名为 .git 的目录,所有 Git 需要的数据和资源都存放在这个目录中
aaa@qq.com MINGW64 /d/gitPlace/InterMCU_4.1 (master)
$ ls -alh
total 8.0K
drwxr-xr-x 1 Administrator 197121 0 10月 17 13:12 ./
drwxr-xr-x 1 Administrator 197121 0 10月 17 13:04 ../
drwxr-xr-x 1 Administrator 197121 0 10月 17 13:12 .git/
drwxr-xr-x 1 Administrator 197121 0 10月 17 12:28 extras/
#将目标文件或目标目标(如extras等)纳入版本控制,以后该文件或目录修改后git提交时会被git管理。
aaa@qq.com MINGW64 /d/gitPlace/InterMCU_4.1 (master)
$ git add extras/
.........................
#为本次提交做简要描述
aaa@qq.com MINGW64 /d/gitPlace/InterMCU_4.1 (master)
$ git commit -m "initialization mcu4.1_vo.1_made_by_duanfuqiang&&zhengkailun"
[master (root-commit) d856f73] initialization mcu4.1_vo.1_made_by_duanfuqiang&&zhengkailun
1163 files changed, 289498 insertions(+)
create mode 100644 extras/basic_example/README.md
....................
#查看git提交日志,确认git已经提交
aaa@qq.com MINGW64 /d/gitPlace/InterMCU_4.1 (master)
$ git log
commit d856f73d38f80bb4c4a9ab050e12b6c3ac0a4625 (HEAD -> master)
Author: duanfuqiang <aaa@qq.com>
Date: Thu Oct 17 13:16:03 2019 +0800
initialization mcu4.1_vo.1_made_by_duanfuqiang&&zhengkailun
#将新项目从本地push到Git服务器
aaa@qq.com MINGW64 /d/gitPlace/InterMCU_4.1 (master)
$ git push --set-upstream aaa@qq.com:InterMCU_4.1 master
Enumerating objects: 1157, done.
Counting objects: 100% (1157/1157), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1095/1095), done.
Writing objects: 100% (1157/1157), 88.19 MiB | 1.21 MiB/s, done.
Total 1157 (delta 261), reused 0 (delta 0)
To 112.112.112.112:InterMCU_4.1
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'aaa@qq.com:InterMCU_4.1'.
上一篇: 手写的wow.js解析
下一篇: es的操作【post软件应用】
推荐阅读