简体   繁体   中英

How do i add my local git repo to my existing bitbucket repo

My local repo name exists here: cd /Volumes/D/Website

Repo Folder Name: Supro

My Bitbucket repo: https://Suprodeep@bitbucket.org/Suprodeep/testlabs.git

When i try to git push it says this:

supro@Homes-MacBook-Air Website % git push supro master           
*To https://bitbucket.org/Suprodeep/testlabs.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://bitbucket.org/Suprodeep/testlabs.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
supro@Homes-MacBook-Air Website %*

When i try to pull first then by:

git pull supro master --allow-unrelated-histories

*error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
fatal: Exiting because of unfinished merge.*

It sounds like you have unmerged changes. Try to commit everything in your repo and the pull:

# Check what's not committed
git status 
# Add everything if you have to, or individually depending on what you want
git add *
git commit
# Then pull
git pull supro master --allow-unrelated-histories

If you don't care about the merge. You can hard reset to HEAD and then pull

git reset --hard HEAD
git pull supro master --allow-unrelated-histories

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM