Github refusing to merge unrelated histories

0

You can leave me the steps to connect to my remote github repository and update all the code that is in that repository, thanks

$ git remote add origin github.com/alexhak1/ThinkSecWEB
fatal: remote origin already exists

$ git push master
fatal: 'master' 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
    
asked by Alejandro Estupiñán 04.11.2018 в 23:59
source

2 answers

1

What is usually done is to clone the repo

git clone [email protected]:alexhak1/ThinkSecWEB.git

By which the folder ThinkSecWEB is created and the remote origin is immediately configured.

It gives me the idea that you did

   git init
   git remote add origin [email protected]:alexhak1/ThinkSecWEB.git

After this, you started creating files and folders.

Either one of the two flows will lead you to repeat the second instruction because the origin already exists

The command

git push master

It will always give an error, because the syntax should be

git push origin master

What does "you have a merge of my local master the remote branch origin / master".

Given the error message in your question, I assume that at some point you put (for example):

git add --all
git commit -am "primer commit local"

And then

git pull

or

git push

or

git push --set-upstream origin master

But your remote has a commit that your local does not have, and vice versa. There is no common ancestor and therefore no merge can be made.

If the remote code is slightly similar to your local code and you really want to do a merge, the solution would be:

git fetch --all
git reset --soft origin/master
git add --all
git commit -am "comit encima del primer commit remoto"
git push origin master

If the codes really have nothing to do, you can do:

git push -f --set-upstream origin master

And with that you're going to step on the remote forcibly with your local commits. Beware that this will lose what is on the remote.

    
answered by 05.11.2018 / 00:34
source
0

As I see your problem is that you are not specifying the 'upstream' where to send the changes

$ git push origin master

Now depending on the error in the description it is likely that the story will differ so you can force the push

$ git push origin master --force

Although it would be best to do a 3way merge and then upload the changes

$ git pull origin master
$ git push origin master
    
answered by 05.11.2018 в 00:34