Monday, January 14, 2019

How to upload your source code to BitBucket?

Software Required
- git version 2.17.2 

Precondition
- BitBucket account has been registered
- Source code repository has been created on BitBucket  

Problems
- I'm a SVN user who heavily rely on it to manage my source code version control. I'm a rookie to use Git on both GitHub/BitBucket platform.
- During my Moodle and Dockers exploration, I decided to use BitBucket and git client to manage my source code.
- The reason I choose BitBucket is it support:- 
  • Unlimited private repository 
  • Git/Mercurial.
Steps
- Assume you have BitBucket account and repository created.
- Clone your empty repository from BitBucket into a source folder by executing the command below. Please fill in [username], [project name] and [repository] parameter based on the user account and repository name that you created at BitBucket.
$ git clone https://[username]@bitbucket.org/[project name]/[repository].git
- Copy your Moodle source code into the source folder
- Run the command below to add all the new files into the staging area.
$ git add .
- Run command below to commit the source code in the staging area into the BitBucket repository with the description
$ git commit -m "First commit"
- Run command below to check on the branch and master differences
$ git status

On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
- If message "Your branch is ahead of 'origin/master' by 1 commit" is observed, run the command below to push the origin to master
$ git push origin master
- Check on the BitBucket console, all the source code is uploaded/committed successfully.



No comments: