Can you leave me the steps to connect to my remote repository on github 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
What is usually done is to clone the repo
Whereby the folder is created
ThinkSecWEB
and the remote is immediately configuredorigin
.It gives me the idea that you did
This done, you started creating files and folders.
Either of the two flows will lead to repeating the second instruction giving you an error because
origin
it already exists .The command
It will always give an error, because the syntax should be
Which means "merge my local master into the remote origin/master branch".
Given the error message in your question, I assume that at some point you put (for example):
And then
either
either
But your remote has a commit that your local doesn't, and vice versa. There is no common ancestor and therefore cannot be merged.
If the remote code is slightly similar to your local code and you do want to do a merge, the solution would be:
If the codes really have nothing to do with it, you can do:
And with that you are going to forcefully step on the remote with your local commits. Beware that with this you will lose what is in the remote.
When the git bash tells us: Github refusing to merge unrelated histories (Github rejects joining unrelated histories) as the question says, the Solution that I have applied, and it has worked for me is
Now if what you want is to merge:
In this way, it is guaranteed that unrelated or unrelated histories (unrelated-histories) can be connected to the repository.
As I see your problem is that you are not specifying the `upstream' where to send the changes.
Now according to the error in the description it is likely that the history differs so you can force the push
Although the best thing would be to do a 3way merge and then upload the changes
Another solution is:
and then
It happens that when you want to add a remote repository to your local repository, the two repositories have different histories and that is why it does not allow merging and so that both can merge, use this command: