geeks
geeks

Reputation: 2055

How to merge my local repository with remote repository on Bitbucket?

I am developing open-stack project which is available on github. Now My team-mates downloaded on their local system and make remote repository on bit-bucket, I want to synchronize with bit-bucket repository on remote. So that I get updated repository on my local system, How I will do that. I already done

[vagrant@localhost horizon]$ git remote rm origin
[vagrant@localhost horizon]$ git remote add origin ssh://[email protected]/user_name/repo_name.git
[vagrant@localhost horizon]$ git push -u origin master
Warning: Permanently added the RSA host key for IP address '131.103.20.167' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Upvotes: 1

Views: 1335

Answers (2)

pratZ
pratZ

Reputation: 3356

Just add the new bitbucket repository as remote.

git remote add neworigin <bitbucket-repo-url>

You can then fetch and merge,

git fetch neworigin
git merge neworigin/<branch>

If you want to name it origin you will have to rename or delete the existing remote.

You also need to make sure you have added an SSH key to your account. Read here on how to add an ssh key In case you do not have a public key. You can generate it by (inside the .ssh directory present in your home directory),

ssh-keygen -t rsa -C "[email protected]"

UPDATE

You are using ssh protocol, use the https url. It will then ask you for the username and password.

Upvotes: 3

Sandeep Kumar
Sandeep Kumar

Reputation: 803

You can use the tool TortoiseHG or SourceTree to sync the remote repository with local

Refer this link to clone it at local

Upvotes: 0

Related Questions