nguyencuc2186
nguyencuc2186

Reputation: 21

Reinitialized existing Git repository when using git init and further?

I am a newbie and trying to using Gitbash to push a code to github. When I use the command

git init

it shows me the error

Reinitialized existing Git repository in C:/User/User/Desktop/xxx.git

Then, when I use the command

git add . it is ok

when I use the command

git commit -m "First commit" it shows me this error

On branch master Your branch is ahead of 'origin/master' by 1 commits Nothing to commit, working tree clean

And final, when I try to use those command

git remote add origin https://github.com/xxx/xxx.git git push origin master

It told me that error: failed to push some refs to https://github.com/xxx/xxx.git

I am very confusing because of this error, could you please help me ? Thank you very much.

Upvotes: 0

Views: 9642

Answers (2)

Abdulrahman
Abdulrahman

Reputation: 905

I have the same problem but I fixed it so just use $ git add . to add all files from your directory

Upvotes: 0

monika
monika

Reputation: 31

Please try this to solve the above problem

$ rm -rf .git 

After this command, use:

$ git init 

Upvotes: 3

Related Questions