小编Jul*_*ENS的帖子

SSH 配置被 git 客户端忽略

我与两个不同的 git 存储库交互,它们都是 GitLab 实现。

由于我需要使用不同的用户(和电子邮件)来访问它们,因此我创建了两个 ssh 密钥:比如说id_rsa_1id_rsa_2。之后我写了一个~/.ssh/config文件来指定何时应该使用每个 id_rsa 文件。配置文件是:

Host gitlab.host1.com-user1
    HostName gitlab.host1.com
    User user1
    IdentityFile ~/.ssh/id_rsa_1

Host gitlab.host2.com-user2
    HostName gitlab.host2.com
    User user2
    IdentityFile ~/.ssh/id_rsa_2
Run Code Online (Sandbox Code Playgroud)

我的问题是每次使用时gitconfig都不会考虑该文件。它一直在寻找 id_rsa 文件。

我的配置文件有什么问题?是否Host只是一个个人识别码,或者它在考虑git寻找钥匙?

我应该提供哪个用户?“git”还是我在每个服务器中注册的真实用户?

我的config文件有什么问题?非常感谢您提前。

git ssh gitlab

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

CTYPES和PYTHON3:无法返回长字符串

我有一个C ++代码,为此我创建了python.ctypes包装器。它工作得很好,除非返回的字符串很长。C代码示例:

extern "C" {

const char * hallo(char * nome)
{
    string str(nome);
    str = "hallo " + str;

    for(int i=0; i<100; i++)
        str += " new content";

    return str.c_str();
}
Run Code Online (Sandbox Code Playgroud)

我的python代码是:

self.lib = ctypes.CDLL(LIB_PATH)
self.lib.hallo.restype = ctypes.c_char_p
self.lib.hallo.argtypes =[ctypes.c_char_p]
j = self.lib.hallo('my name'.encode())
print('INIT: ' + j.decode())
Run Code Online (Sandbox Code Playgroud)

字符串大小是动态的(实际上,它将是json字符串)。处理这种情况的最佳方法是什么?

非常感谢。

c++ python ctypes

0
推荐指数
1
解决办法
720
查看次数

标签 统计

c++ ×1

ctypes ×1

git ×1

gitlab ×1

python ×1

ssh ×1