You need to run this command from a local git repository (a directory in which you have run git init
or git clone
) - otherwise git remote
doesn't know which local repo you want to add the remote for.
It should be as simple as cd my-local-dir
, where my-local-dir
is the directory containing your local (cloned) git repository.
If you don't yet have the repo available locally:
git clone git@github.com:...etc... my-local-dir
cd my-local-dir
git remote add ButbucketRepo git@bitbucket.org...
git push -u ButbucketRepo master
This will clone your code from Github into the my-local-dir
directory, add your BitBucket repo as a remote repository, push your code up to Bitbucket and set the local master
branch to track the BitBucket remote's master
branch.
Tracking means that commands that involve a remote like git push
will automatically use the BitBucket remote's master
branch. If you don't want that behaviour, skip the -u option.