Search This Blog

Thursday, September 19, 2024

How to add git remote origin to your local app


Follow the steps below add git remote origin to your local app :

  1. Use git init to create a new local repository.
  2. Add files and perform a git commit.
  3. Obtain the Git URL of the remote repo.
  4. Issue the git remote add origin command.
  5. Use the git push command to upload your files.

Commands are:

git init

git add --all

git commit -m "test_msg" 

copy remote URL from Git 


git remote add origin https://github.com/<user>/learnCAP.git

git push -u origin master


What if the remote repo isn't empty?

If it shows the error of conflicts or asks to pull if the remote is not empty and you don't want to pull as it is a fresh repo then you can force this via the force option below:

git push -u -f origin master


Hope it will help !! 


Cheers

Kapil 





No comments:

Post a Comment

Thanks for your comment, will revert as soon as we read it.

Popular Posts