Git: how to upload a local repository to Bitbucket


Step 1: change dir to your repo’s directory

cd D:/TypeScript/Dbf/

Step 2: git init

Result:

Initialized empty Git repository in D:/TypeScript/Dbf/.git/

Step 3:

git remote add origin https://bitbucket.org/user/repo.git

Step 4:
git pull origin master

Result:

Username for 'https://bitbucket.org': user@gmail.com
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From https://bitbucket.org/user/repo
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master

Step 5:
git add .

Result:

warning: LF will be replaced by CRLF in package-lock.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in package.json.
The file will have its original line endings in your working directory.
...

Step 6:
git commit -m "your comment"

Example:
git commit -m "v1"

Result:

[master e9a958e] v1
 821 files changed, 183104 insertions(+)
 create mode 100644 api.js
 create mode 100644 api.ts
...

Step 6:
git push origin master

Result:

Username for 'https://bitbucket.org': user@gmail.com
Counting objects: 977, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (938/938), done.
Writing objects: 100% (977/977), 2.44 MiB | 61.00 KiB/s, done.
Total 977 (delta 275), reused 0 (delta 0)
remote: Resolving deltas: 100% (275/275), completed with 1 local object.
To https://bitbucket.org/user/repo.git
   6c98737..e9a958e  master -> master

Leave a Reply