Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push on GIT and Bitbucket

Tags:

git

bitbucket

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>.

enter image description here

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.

enter image description here

My repository is created

enter image description here

Now, I open GIT bash.

Here are my steps:

1- git init 
2- git clone https://[email protected]/Geek8006/azerty.git
3- git status

enter image description here

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

enter image description here

Then...

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

enter image description here

When I do the last step:

7- git push origin master

enter image description here

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.

like image 285
joel Avatar asked May 10 '26 07:05

joel


2 Answers

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.

like image 148
VonC Avatar answered May 12 '26 10:05

VonC


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"
like image 37
Matt Avatar answered May 12 '26 10:05

Matt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!