我为我的 GitLab 存储库创建了一个 SSH 密钥,当我使用 SSH 测试它时,它确实有效并要求输入密码:
>ssh -T git@gitlab.lrz.de
Enter passphrase for key 'C:\Users\[username]/.ssh/id_ed25519':
Welcome to GitLab, @000[...]!
Run Code Online (Sandbox Code Playgroud)
我也用过
>git remote set-url origin git@gitlab.lrz.de:000[...]/project.git
Run Code Online (Sandbox Code Playgroud)
没有错误。但是,当我尝试提交并推送到存储库时,Git 会询问 SSH 密钥的密码git@gitlab.lrz.de,而不是密码。
根据文档(https://docs.gitlab.com/ee/ssh/),您可以在配置文件中设置 ssh 密钥~/.ssh/config。因此,我在此目录中创建了一个包含以下内容的文本文件:
Host gitlab.lrz.de
HostName gitlab.lrz.de
IdentityFile ~/.ssh/id_ed25519
Run Code Online (Sandbox Code Playgroud)
它仍然无法工作,我不确定它是否使用这个配置文件。我能够在 Linux 服务器上运行所有内容,但不能在这台 Windows 计算机上运行。我通过命令行和 Pycharm 尝试过。
>git --version
git version 2.35.1.windows.1
Run Code Online (Sandbox Code Playgroud) 我有两个包含浮点值的排序列表。第一个包含我感兴趣的值(l1),第二个列表包含我要搜索的值(l2)。但是,我不是在寻找完全匹配的内容,而是在容忍基于函数的差异。由于我经常进行此搜索(>> 100000),并且列表可能很大(〜5000和〜200000个元素),因此我对运行时非常感兴趣。起初,我以为可以使用numpy.isclose(),但是我的宽容度不是固定的,而是取决于兴趣的价值。几个嵌套的for循环可以工作,但是速度很慢。我确信有一些有效的方法可以做到这一点。
#check if two floats are close enough to match
def matching(mz1, mz2):
if abs( (1-mz1/mz2) * 1000000) <= 2:
return True
return False
#imagine another huge for loop around everything
l1 = [132.0317, 132.8677, 132.8862, 133.5852, 133.7507]
l2 = [132.0317, 132.0318, 132.8678, 132.8861, 132.8862, 133.5851999, 133.7500]
d = {i:[] for i in l1}
for i in l1:
for j in l2:
if matching(i, j):
d[i].append(j)
Run Code Online (Sandbox Code Playgroud)
fyi:作为匹配函数的替代方法,我还可以先创建一个字典,将感兴趣的值映射l1到(min ,max)我允许的窗口中。例如{132.0317:(132.0314359366, …