Push code to a new GitHub repository

Andres Sandoval
1 min readDec 17, 2021

How to push your local code to a new GitHub repo:

  1. Create a repo on GitHub.
  2. When you create a new repo you will get the below steps in your screen, with the correct repo name. (below is my repo name)
echo "# AndroidComposeAdMobSDK" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:AndreSand/AndroidComposeAdMobSDK.git
git push -u origin main

Second commit:

git add * -f
git commit -m "first commit"
git push -u origin main

Remove original GitHub repository

  1. Remove origin repo with below command:
$git remote remove origin

2. Add new repo origin :

$git remote add origin git@github.com:AndreSand/{{repo_Name}}.git

3. Push code

$git push -u origin main

Push all code changes

$git commit -a


Follow GitHub instructions.