小编u12*_*123的帖子

测量git存储库的大小/ MB增长率?

我有一个几个月大的git repo.是否可以计算/绘制内部git存储库的大小(以MB为单位)(压缩大小)作为提交到远程的提交(或该事项的日期)的函数?

由于分支可以并行开发,因此给定的提交可能不会反映被推送到另一个分支的更改.

因此,每天都有一个运行git pull的CI工作,然后是:https: //git-scm.com/docs/git-count-objects

并将结果存储在db中可能是一种方法.这假定在创建存储库的同一天激活CI作业.

如果有可能在现有的存储库中及时计算这些信息,那就太棒了.

我知道使用提交并没有多大意义.我希望通过某种方式了解它如何随着时间的推移而增加尺寸,就像它们在这里一样:http: //blogs.wandisco.com/2013/08/23/git-repository-metrics/

git repository filesize

5
推荐指数
1
解决办法
602
查看次数

哪个 git commit/branch 包含这个 blob?

我正在使用此脚本来计算存储库中的 n 个最大的 blops:

https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/

输出示例:

54016,13273,0ef462bf57e8c036b00b52d6cc0fd91b2fc2a827 Data/Db.MDF
30976,8734,3e162c8313995980c8d6fc434c06789373364a47 Tools/connector.dll
Run Code Online (Sandbox Code Playgroud)

上面的两个 SHA 是 blob 的 SHA。现在我想找到包含这些斑点的提交/分支。我首先尝试:

$ git branch -a --contains 3e162c8313995980c8d6fc434c06789373364a47
error: object 3e162c8313995980c8d6fc434c06789373364a47 is a blob, not a commit
Run Code Online (Sandbox Code Playgroud)

正如上面的消息所述,SHA 适用于 blob,而不是提交。这让我想到:哪个提交有这个 blob?

我已经从上面的帖子创建了两个脚本,并将它们添加到我的存储库的根目录中。但是当我运行它们时,没有任何输出:

MINGW64 /c/tmp/MyRepo (master)
$ ./blop-to-commit.sh 3e162c8313995980c8d6fc434c06789373364a47

MINGW64 /c/tmp/MyRepo (master)
Run Code Online (Sandbox Code Playgroud)

还尝试在存储库的本地裸克隆上运行它:

MINGW64 /c/tmp/MyRepo.bare (BARE:master)
$ ./blop-to-commit.sh 3e162c8313995980c8d6fc434c06789373364a47

MINGW64 /c/tmp/MyRepo.bare (BARE:master)
Run Code Online (Sandbox Code Playgroud)

有什么想法为什么我在历史上的某个时刻没有得到包含该错误的提交/分支?

编辑/解决方案:

似乎我只需将 --all 选项添加到 git log 命令:

shift
git log --all "$@" --pretty=format:'%T %h %s' \
| while read tree commit subject ; …
Run Code Online (Sandbox Code Playgroud)

git

5
推荐指数
1
解决办法
2850
查看次数

Git reflog 并进行新的克隆?

如果您想跟踪 git 存储库中发生的更改,您可以使用https://git-scm.com/docs/git-reflog例如,如果分支被意外本地/远程删除,则可以恢复该分支?

但据我了解 git reflog 仅在本地存储库的上下文中才有意义。这意味着每次您进行全新克隆时,所有分支的 git reflog 都将为空。那是对的吗?

git

5
推荐指数
1
解决办法
1415
查看次数

无法安装psget

我试图在管理模式下从powershell在Windows 10上安装psget,但我得到:

PS C:\Windows\system32> (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
Downloading PsGet from https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1
Invoke-WebRequest : The given path's format is not supported.
At line:42 char:13
+             Invoke-WebRequest -Uri $Url -OutFile $SaveToLocation
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
    + FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Import-Module : The specified module 'C:\Users\myuser\Documents\WindowsPowerShell\Modules C:\Users\myuser\Documents\WindowsPowerShell\Modules\PsGet' was not loaded
because no valid module file was found in any module directory.
At line:105 char:9
+         Import-Module -Name $Destination\PsGet
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\Users\myuser\Do...l\Modules\PsGet:String) …
Run Code Online (Sandbox Code Playgroud)

powershell

5
推荐指数
1
解决办法
890
查看次数

删除git rebase -i中的提交不会减小.git文件夹的大小

我有一个git存储库,.git文件夹是7MB.然后我添加并提交了一个16MB的.exe文件,后跟:

git gc --aggressive && git prune
Run Code Online (Sandbox Code Playgroud)

以上我的.git文件夹现在是23MB.

接下来我做了一个git rebase -i选定的下拉:

在此输入图像描述

在引入16MB文件的提交(c8185ff)上,我完成了rebase并再次运行:

git gc --aggressive && git prune
Run Code Online (Sandbox Code Playgroud)

现在当我测量.git文件夹时它仍然是23MB.

应该git rebase在上面执行不完全从历史记录中删除提交 - 好像文件从未被引入 - 因此将.git文件夹恢复到7MB大小?

我还试图对存储库进行全新的克隆,大小仍然是23MB - 我假设在进行新的克隆时将清除reflog.

git

5
推荐指数
1
解决办法
108
查看次数

在 docker 容器中执行真正的 SSH

我正在尝试使用本指南:

https://docs.docker.com/engine/examples/running_ssh_service/#run-a-test_sshd-container

要对正在运行的容器执行普通 SSH,首先尝试获取运行容器的 ip 地址:

$ sudo docker inspect 4b928aca09ae

        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "74ce28dd93a6fa6158ebc3f4ec73f1dba74ddbfc183f4ebf9cca77ced2571174",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "22/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "32768"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/74ce28dd93a6",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "5927380d426ce9d5684dc17982c7f01af38d850218aa476d6ed8f457c8a39165",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.8",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:08",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "9c02e185366bb205bded7cab97766cb0e91315a4317affedc98f299831d5ceae",
                    "EndpointID": "5927380d426ce9d5684dc17982c7f01af38d850218aa476d6ed8f457c8a39165",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.8",
                    "IPPrefixLen": 16,
Run Code Online (Sandbox Code Playgroud)

基于上述,我试图:

$ ssh …
Run Code Online (Sandbox Code Playgroud)

ssh docker

5
推荐指数
1
解决办法
5766
查看次数

找不到Jenkinsfile不符合条件

我已经使用Git SCM创建了一个Jenkins(Jenkins版本2.60.1)多分支管道作业。在master分支的存储库的根目录中,我有一个有效的Jenkinsfile,但是当我扫描作业时,我得到:

  Checking branch master
      ‘Jenkinsfile’ not found
    Does not meet criteria
Run Code Online (Sandbox Code Playgroud)

工作配置:

在此处输入图片说明

有任何想法吗?

jenkins

5
推荐指数
1
解决办法
1587
查看次数

无法引导(云类型:localhost) - 使用LXD/Conjure-up在本地安装Kuberneters群集时出错

使用Ubuntu 18.04.

我正在尝试使用本指南(LXD + conjure-up kubernetes)在我的本地计算机(localhost)上安装kubernetes集群:

https://kubernetes.io/docs/getting-started-guides/ubuntu/local/#before-you-begin

当我跑:

conjure-up kubernetes
Run Code Online (Sandbox Code Playgroud)

我选择以下安装:

在此输入图像描述

并选择localhost"选择云"并使用安装向导其余部分的默认值.然后它开始安装,30-40分钟后它就完成了这个错误:

在此输入图像描述

这是日志:https: //pastebin.com/raw/re1UvrUU

哪一个错误说:

2018-07-25 20:09:38,125 [ERROR] conjure-up/canonical-kubernetes - events.py:161 - Unhandled exception in <Task finished coro=<BaseBootstrapController.run() done, defined at /snap/conjure-up/1015/lib/python3.6/site-packages/conjureup/controllers/juju/bootstrap/common.py:15> exception=BootstrapError('Unable to bootstrap (cloud type: localhost)',)>
Run Code Online (Sandbox Code Playgroud)

但这并没有多大帮助.

对安装向导/召唤失败原因的任何建议?

也基于这篇文章:

https://github.com/conjure-up/conjure-up/issues/1308

我试过先禁用防火墙:

sudo ufw disable
Run Code Online (Sandbox Code Playgroud)

然后重新运行安装/召唤安装向导.但我得到了同样的错误.

有关如何安装和配置LXD /召唤的更多详细信息如下:

$ snap install lxd
lxd 3.2 from 'canonical' installed
$ /snap/bin/lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: 
Do you want to configure a …
Run Code Online (Sandbox Code Playgroud)

kubernetes lxd

5
推荐指数
1
解决办法
584
查看次数

X-Forwarded-Proto https在前端或后端(HAProxy)?

我在后端服务器应用程序前面设置了HAProxy以启用HTTPS.我已经读过我需要设置的内容X-Forward-Proto https.

haproxy.cfg文件中,我尝试在前端执行以下操作:

frontend haproxy
  bind :8443 ssl crt frontend/server.pem
  reqadd X-Forwarded-Proto:\ https
  default_backend my-backend
Run Code Online (Sandbox Code Playgroud)

这似乎使它工作 - 例如,我可以登录到我的后端服务器并导航到不同的页面.如果我没有proto选项,我只能登录但不能导航到任何其他页面.

现在我在后端添加选项(从前端删除):

backend my-backend
  http-request add-header X-Forwarded-Proto https if { ssl_fc }
  server my-backend 127.0.0.1:9000
Run Code Online (Sandbox Code Playgroud)

它也有效,我可以导航我的后端服务器应用程序中的不同页面.

那么这是正确的方法呢?在前端或后端还是没关系?

https haproxy

5
推荐指数
1
解决办法
5440
查看次数

使用curl/REST和令牌将SSH公钥上传到bitbucket云

我有一个bitbucket云帐户.在:https://id.atlassian.com/manage/api-tokens我生成了一个API令牌,我试图在REST调用中将公共SSH密钥上传到我的帐户.基于:

https://docs.atlassian.com/bitbucket-server/rest/5.6.2/bitbucket-ssh-rest.html?utm_source=%2Fstatic%2Frest%2Fbitbucket-server%2F5.6.2%2Fbitbucket-ssh-rest.html&utm_medium = 301#idm45427244388592

https://community.atlassian.com/t5/Answers-Developer-Questions/Bitbucket-REST-API-POST-using-token-instead-of-basic-auth/qaq-p/474823

我试过了:

curl -X POST -d '{"text":"ssh-rsa AAAAB3... me@127.0.0.1"}' -H "Authorization: Bearer ADasdaEeasAsd..." https://bitbucket.org/[my-account]]/rest/ssh/latest/keys
Run Code Online (Sandbox Code Playgroud)

但当我跑步时,我得到:

{"type": "error", "error": {"message": "Access token expired. Use your refresh token to obtain a new access token."}}
Run Code Online (Sandbox Code Playgroud)

我试图重新创建令牌并重新运行上面的命令 - 使用新令牌 - 但我得到了同样的错误.

有什么建议?

根据以下答案和链接,我现在尝试:

curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wxdrtblabla..." \
-d '{"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY myuser@bitbucket.org/myuser"}' \
https://api.bitbucket.org/2.0/users/myuser/ssh-keys
Run Code Online (Sandbox Code Playgroud)

但我得到完全相同的错误:

{"type": "error", "error": {"message": "Access token expired. Use your refresh token to …
Run Code Online (Sandbox Code Playgroud)

rest curl bitbucket

5
推荐指数
1
解决办法
488
查看次数

标签 统计

git ×4

bitbucket ×1

curl ×1

docker ×1

filesize ×1

haproxy ×1

https ×1

jenkins ×1

kubernetes ×1

lxd ×1

powershell ×1

repository ×1

rest ×1

ssh ×1