Nigel Nigel - 3 months ago 18
Git Question

Git push to remote repository started with git init

I have a folder with VS Solution with few projects and so on. I've created a GitHub repository and uploaded the contents of that directory via the web interface.
Now, changes have been made to my projects, and I want to start pushing those to my github repository. So I use

git init
, than stage and commit files.

But I can't push because
"Updates were rejected because the remote contains work that you do not have locally."


But I can't pull either because

git pull RemoteName master
// refusing to merge unrelated histories

So I try to
fetch
and
merge
in order to use
--allow-unrelated-histories
with merge as suggested somewhere, but fail miserably because of not understanding how merge really works while cursing I didn't red git manual after chapter 1 :)

Seriously how to proceed from here?

git fetch RemoteName
//Ok

git merge RemoteName
//No remote for the current branch.

git merge RemoteName master
//merge: RemoteName - not something we can merge

Answer

You have two unrelated projects. One on github and second on your hdd, because you copied files only via web browser without git commands. Try this - backup your project on hdd to another directory and then delete project from directory, which you want to synchronize with gitlab. Then in your directory write command git clone your_link_from_gitlab. The project downloads from gitlab to your hdd and will be synchronized.

Comments