我与两个不同的 git 存储库交互,它们都是 GitLab 实现。
由于我需要使用不同的用户(和电子邮件)来访问它们,因此我创建了两个 ssh 密钥:比如说id_rsa_1和id_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)
我的问题是每次使用时git,config都不会考虑该文件。它一直在寻找 id_rsa 文件。
我的配置文件有什么问题?是否Host只是一个个人识别码,或者它在考虑git寻找钥匙?
我应该提供哪个用户?“git”还是我在每个服务器中注册的真实用户?
我的config文件有什么问题?非常感谢您提前。
我有一个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字符串)。处理这种情况的最佳方法是什么?
非常感谢。