geekan / MetaGPT

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
https://deepwisdom.ai/
MIT License
44.46k stars 5.3k forks source link

windows下使用git导致问题。并询问为什么需要git? #1087

Closed whoisfucker closed 1 week ago

whoisfucker commented 7 months ago

PS D:\Documents\Python Studio\metagpt\MetaGPT> metagpt "write a cli blackjack game" 2024-03-24 01:04:39.495 | INFO | metagpt.const:get_metagpt_package_root:29 - Package root set to d:\documents\python studio\metagpt\metagpt 2024-03-24 01:04:41.386 | INFO | metagpt.team:invest:90 - Investment: $3.0. 2024-03-24 01:04:41.387 | INFO | metagpt.roles.role:_act:391 - Alice(Product Manager): to do PrepareDocuments(PrepareDocuments) 2024-03-24 01:04:41.810 | WARNING | metagpt.utils.common:wrapper:649 - There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory. 2024-03-24 01:04:41.813 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp: Traceback (most recent call last): File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\objects\commit.py", line 613, in create_from_tree repo.head.set_commit(new_commit, logmsg=message) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 313, in set_commit self.set_object(commit, logmsg) ValueError: Reference at 'refs/heads/master' does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 550, in run rsp = await self.react() ValueError: SHA could not be resolved, git returned: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\common.py", line 626, in wrapper result = await func(self, *args, **kwargs) File "d:\documents\python studio\metagpt\metagpt\metagpt\team.py", line 134, in run await self.env.run() Exception: Traceback (most recent call last): File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\objects\commit.py", line 613, in create_from_tree repo.head.set_commit(new_commit, logmsg=message) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 313, in set_commit self.set_object(commit, logmsg) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 346, in set_object return self._get_reference().set_object(object, logmsg) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\reference.py", line 82, in set_object oldbinsha = self.commit.binsha File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 274, in _get_commit obj = self._get_object() File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 267, in _get_object return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path))) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 159, in dereference_recursive hexsha, ref_path = cls._get_ref_info(repo, ref_path) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 258, in _get_ref_info return cls._get_ref_info_helper(repo, ref_path) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 241, in _get_ref_info_helper raise ValueError("Reference at %r does not exist" % ref_path) ValueError: Reference at 'refs/heads/master' does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 550, in run rsp = await self.react() File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 517, in react rsp = await self._react() File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 463, in _react rsp = await self._act() File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 392, in _act response = await self.rc.todo.run(self.rc.history) File "d:\documents\python studio\metagpt\metagpt\metagpt\actions\prepare_documents.py", line 46, in run self._init_repo() File "d:\documents\python studio\metagpt\metagpt\metagpt\actions\prepare_documents.py", line 41, in _init_repo self.context.git_repo = GitRepository(local_path=path, auto_init=True) File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\git_repository.py", line 55, in init self.open(local_path=local_path, auto_init=auto_init) File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\git_repository.py", line 71, in open return self._init(local_path) File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\git_repository.py", line 85, in _init self._repository.index.commit("Add .gitignore") File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\index\base.py", line 1050, in commit rval = Commit.create_from_tree( File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\objects\commit.py", line 617, in create_from_tree master = git.refs.Head.create( File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 661, in create return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 602, in _create target = repo.rev_parse(str(reference)) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\repo\fun.py", line 378, in rev_parse obj = cast(Commit_ish, name_to_object(repo, rev)) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\repo\fun.py", line 187, in name_to_object return Object.new_from_sha(repo, hex_to_bin(hexsha)) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\objects\base.py", line 94, in new_from_sha oinfo = repo.odb.info(sha1) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\db.py", line 40, in info hexsha, typename, size = self._git.get_object_header(bin_to_hex(binsha)) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\cmd.py", line 1384, in get_object_header return self.get_object_header(cmd, ref) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\cmd.py", line 1371, in get_object_header return self._parse_object_header(cmd.stdout.readline()) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\cmd.py", line 1330, in _parse_object_header raise ValueError("SHA could not be resolved, git returned: %r" % (header_line.strip())) ValueError: SHA could not be resolved, git returned: b''

PS D:\Documents\Python Studio\metagpt\MetaGPT> metagpt "write a cli blackjack game" 2024-03-24 01:07:09.857 | INFO | metagpt.const:get_metagpt_package_root:29 - Package root set to d:\documents\python studio\metagpt\metagpt 2024-03-24 01:07:11.796 | INFO | metagpt.team:invest:90 - Investment: $3.0. 2024-03-24 01:07:11.796 | INFO | metagpt.roles.role:_act:391 - Alice(Product Manager): to do PrepareDocuments(PrepareDocuments) 2024-03-24 01:07:12.238 | WARNING | metagpt.utils.common:wrapper:649 - There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory. 2024-03-24 01:07:12.241 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp: Traceback (most recent call last): File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\objects\commit.py", line 613, in create_from_tree repo.head.set_commit(new_commit, logmsg=message) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 313, in set_commit self.set_object(commit, logmsg) ValueError: Reference at 'refs/heads/master' does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 550, in run rsp = await self.react() ValueError: SHA could not be resolved, git returned: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\common.py", line 626, in wrapper result = await func(self, *args, **kwargs) File "d:\documents\python studio\metagpt\metagpt\metagpt\team.py", line 134, in run await self.env.run() Exception: Traceback (most recent call last): File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\objects\commit.py", line 613, in create_from_tree repo.head.set_commit(new_commit, logmsg=message) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 313, in set_commit self.set_object(commit, logmsg) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 346, in set_object return self._get_reference().set_object(object, logmsg) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\reference.py", line 82, in set_object oldbinsha = self.commit.binsha File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 274, in _get_commit obj = self._get_object() File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 267, in _get_object return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path))) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 159, in dereference_recursive hexsha, ref_path = cls._get_ref_info(repo, ref_path) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 258, in _get_ref_info return cls._get_ref_info_helper(repo, ref_path) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 241, in _get_ref_info_helper raise ValueError("Reference at %r does not exist" % ref_path) ValueError: Reference at 'refs/heads/master' does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 550, in run rsp = await self.react() File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 517, in react rsp = await self._react() File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 463, in _react rsp = await self._act() File "d:\documents\python studio\metagpt\metagpt\metagpt\roles\role.py", line 392, in _act response = await self.rc.todo.run(self.rc.history) File "d:\documents\python studio\metagpt\metagpt\metagpt\actions\prepare_documents.py", line 46, in run self._init_repo() File "d:\documents\python studio\metagpt\metagpt\metagpt\actions\prepare_documents.py", line 41, in _init_repo self.context.git_repo = GitRepository(local_path=path, auto_init=True) File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\git_repository.py", line 55, in init self.open(local_path=local_path, auto_init=auto_init) File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\git_repository.py", line 71, in open return self._init(local_path) File "d:\documents\python studio\metagpt\metagpt\metagpt\utils\git_repository.py", line 85, in _init self._repository.index.commit("Add .gitignore") File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\index\base.py", line 1050, in commit rval = Commit.create_from_tree( File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\objects\commit.py", line 617, in create_from_tree master = git.refs.Head.create( File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 661, in create return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\refs\symbolic.py", line 602, in _create target = repo.rev_parse(str(reference)) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\repo\fun.py", line 378, in rev_parse obj = cast(Commit_ish, name_to_object(repo, rev)) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\repo\fun.py", line 187, in name_to_object return Object.new_from_sha(repo, hex_to_bin(hexsha)) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\objects\base.py", line 94, in new_from_sha oinfo = repo.odb.info(sha1) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\db.py", line 40, in info hexsha, typename, size = self._git.get_object_header(bin_to_hex(binsha)) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\cmd.py", line 1384, in get_object_header return self.get_object_header(cmd, ref) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\cmd.py", line 1371, in get_object_header return self._parse_object_header(cmd.stdout.readline()) File "C:\Users\yuan\AppData\Local\Programs\Python\Python310\lib\site-packages\git\cmd.py", line 1330, in _parse_object_header raise ValueError("SHA could not be resolved, git returned: %r" % (header_line.strip())) ValueError: SHA could not be resolved, git returned: b''

iorisa commented 7 months ago

git是用来管理MetaGPT开发的软件的版本的。 MetaGPT本身支持增量追加需求,为了方便开发者拉分支、回滚等,所以增加了git,用来管理软件的版本。 你在控制台终端里输入git有提示吗?

yigengjiang commented 5 months ago

请问这个报错有解决吗?我也遇到了同样的问题

yigengjiang commented 5 months ago

git是用来管理MetaGPT开发的软件的版本的。 MetaGPT本身支持增量追加需求,为了方便开发者拉分支、回滚等,所以增加了git,用来管理软件的版本。 你在控制台终端里输入git有提示吗?

可以不使用git吗?如何解决这个报错呢?

iorisa commented 1 week ago

如果要在windows系统下使用,可以安装一个linux shell模拟环境,比如Cygwin,可以很好的解决这个问题。

iorisa commented 1 week ago

If there are no further questions, this issue will be closed. If you have any other questions, you can reopen this issue or create a new one.