Python 3.x 试图通过Python Gitlab api将gz文件上载到Gitlab
我正试图通过python gitlab api将一个.gz文件上传到gitlab。然而,我发现唯一可以这样做的文档是通过createfile 我已经尝试使用我的gz文件,但是,我得到的错误代码是Python 3.x 试图通过Python Gitlab api将gz文件上载到Gitlab,python-3.x,gitlab,Python 3.x,Gitlab,我正试图通过python gitlab api将一个.gz文件上传到gitlab。然而,我发现唯一可以这样做的文档是通过createfile 我已经尝试使用我的gz文件,但是,我得到的错误代码是 UnicodeDecodeError:“utf-8”编解码器无法解码位置1中的字节0x8b:无效的开始字节 f = project.files.create({'file_path': 'testfile.txt', 'branch': 'maste
UnicodeDecodeError:“utf-8”编解码器无法解码位置1中的字节0x8b:无效的开始字节
f = project.files.create({'file_path': 'testfile.txt',
'branch': 'master',
'content': file_content,
'author_email': 'test@example.com',
'author_name': 'yourname',
'commit_message': 'Create testfile'})
我的预期结果是能够通过API或其他方法将gz文件上载到Gitlab。我最终使用了paramiko并通过该库进行连接。为了解决这个问题,我最终使用了ssh.exec_命令并键入了我所有的命令,后跟一个\n