-1

I am working on a IOS App, and had an existing project on bitbucket. I then downloaded the project, and started working on it, changing a lot of the files. Now, my question is, how do I connect my local project, to the existing bitbucket project? All I can find is creating a new repository, or connecting from an existing, which I'm afraid will overwrite my changes.

EDIT: So I did the following and here is what I get.

git init
git add .
git commit -m "changing stuff"
git remote add origin https.bitbucket.org/myrepository
git push -u origin master

and the error I get is,
hint: Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.

Ryan B.
  • 99
  • 2
  • 14
  • Is your existing local project a git repo? – msanford Nov 13 '17 at 15:45
  • Bitbucket has an excellent tutorial but in a nutshell you need to `git init` and then add the remote. ;-) https://confluence.atlassian.com/bitbucket/set-up-a-repository-877174034.html – Edwin Nov 13 '17 at 15:46
  • I don't think it is a repo. – Ryan B. Nov 13 '17 at 15:57
  • So, thats the problem, i have two separate files, that are actually the same project. But not connected, They only show if one is new or one is existing. – Ryan B. Nov 13 '17 at 16:00
  • Possible duplicate of [git: updates were rejected because the remote contains work that you do not have locally](https://stackoverflow.com/questions/24357108/git-updates-were-rejected-because-the-remote-contains-work-that-you-do-not-have) – phd Nov 13 '17 at 17:43

2 Answers2

0

Check for git remote --help.

git remote add command then git push on the remote you added should do the job.

jseguillon
  • 393
  • 1
  • 10
0

So here is what I did, I forced my new project in to the repository.

git init
git add .
git commit -m "changing stuff"
git remote add origin https.bitbucket.org/myrepository
git push -f origin master
Ryan B.
  • 99
  • 2
  • 14