- Created repository folder with a file inside inside. Something like: /Repositories/NewRepo/helloworld.txt
- Open console inside of the NewRepo folder. It initiates a new git repository in the NewRepo folder:
git init
-
We're adding the file (proposing the changes) by using:
git add helloworld.txt
or
git add *
-
To commit the changes we use:
git commit -m "Adding helloworld.txt" - We create a repository in https://bitbucket.org/ by clicking "Create Repository" button and just filling out the form. We end up having bitbucket repository called: BitbucketLogin/reponame. Lets say our reponame is also NewRepo.
We need to add a remote to the bitbucket repository:
git remote add origin https:/BitbucketLogin@bitbucket.org/BitbucketLogin/oureponame.git
In case we're trying to commit to someone else's repo, we should use:
git remote add origin https:/OurLogin@bitbucket.org/SomeonesLogin/soomeoneseponame.git - If we made a typo in the above, we can remove the remote and add it again:
git remote rm origin
-
All that is left is to push the changes to bitbucket:
git push origin master
Friday, 10 January 2014
Hooking up a new git repository to bitbucket
I always forget one of the steps and end up googling. That's why I'll leave this little list here to have a safety net next time I'm connecting my local repo to bitbucket.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment