Upload file to repository

Go to your repository  and click " I'm starting from scratch ". Your will see some code, and you will also see your repository URL. My repository URL is https://aj3sh@bitbucket.org/aj3sh/myrepository.git

Now let's create example project. Create three text files with different names  ( eg 1.txt, 2.txt, 3.txt ) and different contents. Right click to the folder and click "Git Bash here" as shown in the image below. Your will see the git prompt.

Now to upload our files to repository follow the code.

  1. Setting my account
    $ git config --global user.email "aj3sh@bitbucket.org"
    You can find your email in your repository URL :

  2. Initializing git to the directory or creating local repository
    $ git init
    Initialized empty Git repository in C:/Users/aj3ss/Desktop/myproject/.git/
  3. Adding files to local repository
    $ git add .
  4. Committing for adding files
    $ git commit -m "First Update"
    [master (root-commit) 6b5deff] First Update
    3 files changed, 3 insertions(+)
    create mode 100644 1.txt
    create mode 100644 2.txt
    create mode 100644 3..txt
  5. Adding remote git repository to upload as name origin
    $ git remote add origin https://aj3sh@bitbucket.org/aj3sh/myrepository.git
  6. Pushing files from local repository to remote repository
    $ git push origin master
    Counting objects: 5, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (5/5), 296 bytes | 74.00 KiB/s, done.
    Total 5 (delta 0), reused 0 (delta 0)
    To https://bitbucket.org/aj3sh/myrepository.git
    * [new branch]      master -> master

Now click on source of your repository in your Bitbucket. You will see your files have been uploaded with the message First update

You must login to comment

No comment yet

  • Online: 7
    Registered users: 7
    Unique visitors: 172
    Total hits: 489