Add existing project to bitbucket using git

Add existing project to bitbucket using git

Add Existing project to bitbucket using git

I am writing these setup since many i want to create a git project out of existing files on my system. At that time I forgot what were the commands.

1. Create bitbucket repo.

2. Go to your project directory in your local system.

3. init the empty git repo.

git init

4. Add files to the repo

git add -A

5. Add your bitbucket repo.

git remote add origin https://codezero@bitbucket.org/codezero/testProject.

6. verify the remote repo

 git remote -v

7. commit all the local files

git commit -m "added the files"

8. Push changes to the repo.

git push origin master

If you have initialize the repo with Readme me it will show error while pushing the files

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

So use the pull the changes from the repo

 git pull origin master  --allow-unrelated-histories

Now the push the files it will work.

Comments