In my desktop, I have a folder named azerty, into this folder I have a file named index.html.
Into this file, I wrote <h1>test</h1>.

On Bitbucket, I have to create my repository. I named this repository like the name of the folder which is on my desktop, so azerty.

My repository is created

Now, I open GIT bash.
Here are my steps:
1- git init
2- git clone https://[email protected]/Geek8006/azerty.git
3- git status

I don't understand why, I have a new folder azerty into my folder azerty (in my desktop)?

Then...
4- git add .
5- git status
6- git commit -m "test"

When I do the last step:
7- git push origin master

I have this error message
$ git push origin master
fatal: 'origin' 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.
In summary, I have 2 problems:
1- Why I have a new folder azerty into my folder azerty in my desktop ?
2- There are several subjects on the
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
like here -> Git push: "fatal 'origin' does not appear to be a git repository - fatal Could not read from remote repository."
But, it does not work.
Thank you a lot for your help.
No need to clone: you can add to your local repopsitory a reference to your new remote repository:
cd C:\path\to\my\repo
git remote add https://url/new/repo
git push -u origin main
That way, you keep your existing local repository, and add it a remote origin for you to push your content.
Make sure to delete your nested clone first.
When you cloned your repository, Git cloned it into a new folder azerty inside the directory that you already initialised as another Git repository. You should use either git clone or git init (and add a remote later) but not both.
So now you have an initialised repository without a remote which is why you get the error that origin is not know. And you have a cloned repository (with a remote) inside the azerty folder.
I recommend that you just delete both local repositories and start from scratch. You can specify the directory that a repository should get cloned into by passing this as an argument to git clone. To use the current directory, simply pass a ..
rm -rf ./.git # remove the .git folder
rm -rf ./azerty # remove the nested repository
git clone <repository> . # clone into current directory
git add index.html
git commit -m "Add index.html"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With