gitbucket的安装及使用

gitbucket

一种代码版本控制工具
下载gitbucket
https://gitbucket.github.io/

下载tomcat
http://tomcat.apache.org/

把gitbucket.war放到tomcat的webapps下,去bin里启动tomcat,自动解压war包(在bin文件夹下命令行里输入startup启动,输入shutdown停止)
打开网页http://localhost:8080/gitbucket

注意关于base url:
重定向链接不要瞎写,我写了个不存在的域名重定向后找不到指定地址,傻眼了。怎么办?每次登陆都重定向咋回来?
在前端页面找改了哪个值,改进了哪个文件里,我给改回来呗,唉没找着。
删掉原来的war包,换个新的来,结果不行。
干脆连tomcat也删喽,再拿个新的war包来,还是重定向。

修改base url,
$ java -Dgitbucket.base_url=http://192.168.1.248:8080 -jar gitbucket.war
https://github.com/gitbucket/gitbucket/wiki/Configure-from-command-line

创建用户,组,项目
https://blog.csdn.net/liuyongheng1991/article/details/80722741

创建好项目和用户后要去上传代码了

在远程端初始化代码仓库
tqhy@tqhy-train1:~$ git init (代码的根目录)
初始化空的 Git 仓库于 /home/tqhy/.git/

建README.md
tqhy@tqhy-train1:~$ touch README.md

加入要上传的文件或文件夹
tqhy@tqhy-train1:~$ git add README.md

提交,后面的字符串为提交说明,""里面啥也没有是不能提交的
tqhy@tqhy-train1:~$ git commit -m "first commit"

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'tqhy@tqhy-train1.(none)')

创建的用户邮箱和名字
tqhy@tqhy-train1:~$ git config --global user.email "lala@163.com"
tqhy@tqhy-train1:~$ git config --global user.name "le"

添加上传仓库地址,将其命名为origin
tqhy@tqhy-train1:~$ git remote add origin http://192.168.1.248:8080/git/root/tq.git

tqhy@tqhy-train1:~$ git remote
origin

tqhy@tqhy-train1:~$ git remote -v
origin http://192.168.1.248:8080/git/root/tq.git (fetch)
origin http://192.168.1.248:8080/git/root/tq.git (push)

tqhy@tqhy-train1:~$ git push -u origin master
error: src refspec master does not match any.
error: 无法推送一些引用到 'http://192.168.1.248:8080/git/root/tq.git'
tqhy@tqhy-train1:~$ ls
autotag code_1.23.1-1525968403_amd64.deb java profile tq_visualization_utils.py 模板 下载
back dlib-19.15 md README.md traincmd 视频 音乐
back141 dlib-19.15.zip model tf train_loss.log 图片 桌面
backup examples.desktop NVIDIA_CUDA-8.0_Samples tfverabat 公共的 文档

tqhy@tqhy-train1:~$ git push -u origin README.md
error: src refspec README.md does not match any.
error: 无法推送一些引用到 'http://192.168.1.248:8080/git/root/tq.git'

tqhy@tqhy-train1:~$ git commit -m 'README.md'
[master (根提交) 5126591] README.md
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md

tqhy@tqhy-train1:~$ git push origin master
Username for 'http://192.168.1.248:8080': le
Password for 'http://le@192.168.1.248:8080':
对象计数中: 3, 完成.
写入对象中: 100% (3/3), 210 bytes | 0 bytes/s, 完成.
Total 3 (delta 0), reused 0 (delta 0)
remote: Updating references: 100% (1/1)
To http://192.168.1.248:8080/git/root/tq.git
* [new branch] master -> master

之后再看windows下的页面,添加了README.md文件。出现上传图标,直接拖拽也可以上传文件

tqhy@tqhy-train1:~$ git push -u origin master
Username for 'http://192.168.1.248:8080': le
Password for 'http://le@192.168.1.248:8080':
To http://192.168.1.248:8080/git/root/tq.git
! [rejected] master -> master (fetch first)
error: 无法推送一些引用到 'http://192.168.1.248:8080/git/root/tq.git'
提示:更新被拒绝,因为远程仓库包含您本地尚不存在的提交。这通常是因为另外
提示:一个仓库已向该引用进行了推送。再次推送前,您可能需要先整合远程变更
提示:(如 'git pull ...')。
提示:详见 'git push --help' 中的 'Note about fast-forwards' 小节。
tqhy@tqhy-train1:~$ git pull
Username for 'http://192.168.1.248:8080': le
Password for 'http://le@192.168.1.248:8080':
remote: Counting objects: 10, done
remote: Finding sources: 100% (8/8)
remote: Getting sizes: 100% (8/8)
remote: Compressing objects: 100% (64980/64980)
remote: Total 8 (delta 1), reused 0 (delta 0)
展开对象中: 100% (8/8), 完成.
来自 http://192.168.1.248:8080/git/root/tq
5126591..652ecf2 master -> origin/master
当前分支没有跟踪信息。
请指定您要合并哪一个分支。
详见 git-pull(1)。

git pull <remote> <branch>

如果您想要为此分支创建跟踪信息,您可以执行:

git branch --set-upstream-to=origin/<branch> master

tqhy@tqhy-train1:~$ git pull origin master
Username for 'http://192.168.1.248:8080': le
Password for 'http://le@192.168.1.248:8080':
来自 http://192.168.1.248:8080/git/root/tq
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
1.jpg | Bin 0 -> 61369 bytes
README.md | 1 +
infer.py | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
label_map.pbtxt | 5 +++++
4 files changed, 78 insertions(+)
create mode 100644 1.jpg
create mode 100644 infer.py
create mode 100644 label_map.pbtxt

tqhy@tqhy-train1:~$ git push -u origin master
Username for 'http://192.168.1.248:8080': le
Password for 'http://le@192.168.1.248:8080':
对象计数中: 5, 完成.
Delta compression using up to 12 threads.
压缩对象中: 100% (4/4), 完成.
写入对象中: 100% (5/5), 586 bytes | 0 bytes/s, 完成.
Total 5 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1)
remote: Updating references: 100% (1/1)
To http://192.168.1.248:8080/git/root/tq.git
652ecf2..6fbfbcd master -> master
分支 master 设置为跟踪来自 origin 的远程分支 master。

上传文件夹,文件夹不为空
tqhy@tqhy-train1:~$ git add tf/tq/aitest
tqhy@tqhy-train1:~$ git commit -m "folder otherpath try"
[master 0b27f8f] folder otherpath try
4 files changed, 77 insertions(+)
create mode 100644 tf/tq/aitest/1.jpg
create mode 100644 tf/tq/aitest/infer.py
create mode 100644 tf/tq/aitest/mao/frozen_inference_graph.pb
create mode 100644 tf/tq/aitest/mao/label_map.pbtxt
tqhy@tqhy-train1:~$ git push -u origin master
Username for 'http://192.168.1.248:8080': le
Password for 'http://le@192.168.1.248:8080':
对象计数中: 8, 完成.
Delta compression using up to 12 threads.
压缩对象中: 100% (6/6), 完成.
写入对象中: 100% (8/8), 222.78 MiB | 31.63 MiB/s, 完成.
Total 8 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1)
remote: Updating references: 100% (1/1)
To http://192.168.1.248:8080/git/root/tq.git
871dc22..0b27f8f master -> master
分支 master 设置为跟踪来自 origin 的远程分支 master。

 origin 已经存在,配置错误地址或者想修改地址,此时只需要将远程配置删除,重新添加即可;

git remote rm origin

git remote add origin https://github.com/***/WebCrawlers.git

再次提交文件即可正常使用

https://www.cnblogs.com/leinuo2016/p/6547818.html

git status                          # 查看本地代码状态

https://www.cnblogs.com/gaoquanquan/p/9501981.html

删除仓库

页面左下角settings

错误:fatal: refusing to merge unrelated histories(没试过,先记下)
git pull origin master – –allow-unrelated-histories

https://blog.csdn.net/yingjie79613/article/details/78698392

原文地址:https://www.cnblogs.com/lely/p/9777513.html