Upload Flutter Project in BitBucket or GitHub

Hamza Asif
4 min readOct 10, 2024

--

Uploading your Flutter project to a Bitbucket repository is a straightforward process that involves initializing Git in your project, committing your code, and pushing it to Bitbucket.

Step 1: Create a New Repository on Bitbucket

  1. Log In to Bitbucket:
  • Go to Bitbucket and log in with your credentials.

2. Create a New Repository:

  • Click on the Repositories menu in the top navigation bar.
  • Select Create repository.

3. Configure Repository Settings:

  • Repository Name: Enter a name for your repository (e.g., my_flutter_app).
  • Access Level: Choose between Private or Public.
  • Include a README?: It’s recommended not to initialize with a README if you’re uploading an existing project.
  • Other Settings: Configure other settings as needed.

4. Create Repository:

  • Click Create repository. You will be directed to a page with instructions to push your existing project.

Note: Flutter Machine Learning & AI Courses

If you want to build Machine Learning and AI based smart Flutter apps then check our Mobile Machine Learning courses on udemy. Avail 92% off with coupon code “MOBILEMLAI” only for a limited time

  1. Flutter & ML : Train Tensorflow Lite models for Flutter Apps
  2. Face Recognition and Detection in Flutter — The 2024 Guide
  3. Flutter & OCR — Build Document Scanner Clone in Flutter
  4. FlutterFlow for Beginners: Build “No Code” Apps in 2024
  5. Flutter & Google Gemini — Build Chatbots and Assistants in Flutter
  6. Train Image Classification Models & Build Smart Flutter Apps
  7. Build Gallery App Clone in Flutter With Circle To Search Feature
  8. Machine Learning for Flutter- The Complete 2024 Guide
  9. Build Flutter Apps Effortlessly with ChatGPT — Zero Coding
  10. Flutter & AI: Build Image & Art Generation Flutter App

Step 2: Prepare Your Flutter Project for Git

  1. Navigate to Your Project Directory: Open your terminal or command prompt and navigate to your Flutter project directory:
cd path/to/your/flutter_project

Initialize Git: Initialize Git in your project directory if you haven’t already:

git init

Add a .gitignore File, if you don’t have it already in your project

touch .gitignore

Add this code in .gitignore file for demo in start

# Flutter/Dart/Pub related
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.flutter/
.packages
pubspec.lock

# Build outputs
build/
ios/Flutter/Flutter.framework
ios/Flutter/Flutter.podspec
android/app/build/

# Misc
*.lock
*.log
*.tmp

Add Files to Git: Add all your project files to Git’s staging area:

git add .

Commit Your Changes: Commit the added files with a descriptive message:

git commit -m "Initial commit"

Step 3: Link Your Local Repository to Bitbucket

  1. Copy the Repository URL:

2. Add Remote Repository: Link your local Git repository to the Bitbucket remote repository:

  • Using HTTPS:
git remote add origin https://bitbucket.org/username/my_flutter_app.git

Check your origins:

git remote -v

You should see output similar to:

origin  https://bitbucket.org/username/my_flutter_app.git (fetch)
origin https://bitbucket.org/username/my_flutter_app.git (push)

Step 4: Push Your Code to Bitbucket

  1. Push to Remote Repository:
git push -u origin main

If you face this issue as i shown below:

Solution:

Here’s what you can do:

  1. Commit or stash your local changes before pulling.
  • If you want to commit your changes:
git add .
git commit -m "Your commit message"

If you don’t want to commit right now and prefer to save your work temporarily:

git stash

After committing or stashing, pull the remote changes:

git pull --rebase origin main --allow-unrelated-histories

If you stashed your changes, apply them back:

git stash pop

Push your changes after resolving the conflict:

git push -u origin main

Note: Flutter Machine Learning & AI Courses

If you want to build Machine Learning and AI based smart Flutter apps then check our Mobile Machine Learning courses on udemy. Avail 92% off with coupon code “MOBILEMLAI” only for a limited time

  1. Flutter & ML : Train Tensorflow Lite models for Flutter Apps
  2. Face Recognition and Detection in Flutter — The 2024 Guide
  3. Flutter & OCR — Build Document Scanner Clone in Flutter
  4. FlutterFlow for Beginners: Build “No Code” Apps in 2024
  5. Flutter & Google Gemini — Build Chatbots and Assistants in Flutter
  6. Train Image Classification Models & Build Smart Flutter Apps
  7. Build Gallery App Clone in Flutter With Circle To Search Feature
  8. Machine Learning for Flutter- The Complete 2024 Guide
  9. Build Flutter Apps Effortlessly with ChatGPT — Zero Coding
  10. Flutter & AI: Build Image & Art Generation Flutter App

--

--

Hamza Asif
Hamza Asif

Written by Hamza Asif

Udemy Instructor, Flutter Dev helping people Integrate ML & AI in Mobile Apps . Visit my courses https://www.udemy.com/user/e1c14fb5-1c9b-45ef-a479-bbc543e33254

No responses yet