If you're wanting to start a software project with version control then git is probably the system you want to be using. This guide will help you setup a local git repository for your project and connect it to your repository on bitbucket.org!
How To Link to heading
- Create local git repository
[stuart@asuka git-test]$ git init
Initialized empty Git repository in /home/stuart/PROGRAMMING/git-test/.git/
- Link local git repository to BitBucket (you will need to create a repository on bitbucket before this step)
[stuart@asuka git-test]$ git remote add origin ssh://git@bitbucket.org/USERNAME/REPOSITORY.git
- Add remote ssh key to bitbucket account
Go to
https://bitbucket.org/account/user/USERNAME/
Select SSH Keys
Click Add Key
Set Location name to the machine hostname or something that will let you be able to identify the key entry
Copy the contents of
~/.ssh/id_rsa.pub
into the Key section (if you don't have a public key then one can be generated withssh-keygen -t rsa
)
- Configure global email & username settings (I recommend that you use the same email address as your BitBucket account for clarity)
[stuart@asuka git-test]$ git config --global user.email "YOUR_EMAIL_ADDRESS"
[stuart@asuka git-test]$ git config --global user.name "YOUR_NAME"
- Commit an initial file (the file must exist in the project directory)
[stuart@asuka git-test]$ git add FILE
[stuart@asuka git-test]$ git commit FILE -m "Initial Commit"
[master (root-commit) ae183f2] initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 FILE
- Push to the BitBucket repository
[stuart@asuka git-test]$ git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 205 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://git@bitbucket.org/**username**/**repository**.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.