Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
250 views
Welcome To Ask or Share your Answers For Others

1 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 github. Then in your directory write command git clone your_link_from_github. The project downloads from github to your hdd and will be synchronized.

You can find nice cheat sheet about git commands here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...