I don't know why fetch causes the error.

Asked 1 years ago, Updated 1 years ago, 80 views

I'm a beginner at Git.
One of the learning activities is Git, and carefully from the beginning

.

Among them, number 9, Use Together - Bare and Clone, Remote Repository, clone (bare) to make your own repository a temporary remote repository.

After that, I have to fetch the temporary remote repository to make it my remote repository, but I can't proceed with the following error.

fatal: 'shared_repo.git' does not appear to be a git repository fatal:
Could not read from remote repository.

Please make sure you have the correct access rights and the repository
exists.

Do you know the cause of this?

git

2022-09-30 21:45

2 Answers

[Self-solved] Thank you.

"From ""B"" to ""git remote-v""

"

origin/Users/MBP/shared_repo.git(fetch)
origin/Users/MBP/shared_repo.git(push)

So, from "Mr. A," "git fetch/Users/MBP/shared_repo.git" passed.


2022-09-30 21:45

Based on the question and comment text and the linked documentation,
/Users/MBP I think there are three directories below.

  • takashis_workspace (first repository created; no remote repository configuration)
  • shared_repo.git (bare repository cloned with takashis_workspace)
  • yuusukes_workspace (a repository cloned with shared_repo.git)

From this state, you have to configure the remote repository for takashis_workspace.

Let's set up a remote repository so that Takashi can reflect changes to the repository that everyone touches and retrieve changes from it.To add a remote repository, use git remote add<name of remote repository><location of remote repository>.

$git remote add origin path/to/shared_repo.git

I think the place where this command was executed was /Users/MBP/takashis_workspace.In that case, the actual command to execute is

$git remote add origin../shared_repo.git#relative path specification

Or

$git remote add origin/Users/MBP/shared_repo.git#absolute path specification

will be .
The reason why it is not working as expected this time is

$git remote add origin shared_repo.git

This is probably because you have specified a non-existent location.

Correct the repository location pointed to by origin and it will return to its original location.

There are several ways to do this, but I think it's easy to remove the wrong setting in origin and reset the correct value.

Specifically, in the /Users/MBP/takashis_workspace directory:

$git remote origin
$ git remote add origin../shared_repo.git

There is also a way to specify the repository, but in this case origin is misconfigured, so I don't think it will work as described in the following documents.


2022-09-30 21:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.