How to push an existing repository to a repository on Github


Step 1: goto website Github to create your new repository example: https://github.com/sansamour/express-ip

Step 2: login github with github-cli

Step 3:
git init
Result:

 MINGW64 /d/AppServ/www/node3/express-ip
$ git init
Initialized empty Git repository in D:/AppServ/www/node3/express-ip/.git/

Step 4:
git add .
Result:

 MINGW64 /d/AppServ/www/node3/express-ip (master)
$ git add .
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 5:
git commit -m "version 1.0.1"
Result:

 MINGW64 /d/AppServ/www/node3/express-ip (master)
$ git commit -m "version 1.0.1"
[master (root-commit) 26f08a3] version 1.0.1
 8 files changed, 1126 insertions(+)
 create mode 100644 README.md
 create mode 100644 lib/index.d.ts
 create mode 100644 lib/index.js
 create mode 100644 package-lock.json
 create mode 100644 package.json
 create mode 100644 src/index.ts
 create mode 100644 test/test.js
 create mode 100644 tsconfig.json

Step 6:

git remote add origin https://github.com/sansamour/express-ip.git

Step 7:
git branch -M main

Step 8:
git push -u origin main
Result:

 MINGW64 /d/AppServ/www/node3/express-ip (main)
$ git push -u origin main
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (13/13), 12.75 KiB | 0 bytes/s, done.
Total 13 (delta 0), reused 0 (delta 0)
To https://github.com/sansamour/express-ip.git
 * [new branch]      main -> main
Branch main set up to track remote branch main from origin.

Leave a Reply