git init
git add .
git commit -m "first"
git push origin ritu
(second is the name of a branch) but it say
fatal: origin does not appear to be a git repository.
fatal: could not read from remote repository.
Please sure you have the correct access rights and the repository exists.
You have to add the remote first, and you probably also want to create a local branch first, so in full:
git init
git remote add origin <url>
# or, instead if init+remote: git clone <url>
git add ...
git commit
git branch ritu
git push origin ritu
git init
will only create a local repository.
You have not defined any link to a remote copy, and git push
will not work.
Depending on what you need :
you only want to keep a local history of your project : you do not need to use any remote copies, and you can just ignore the git push
step.
you want to share this project with other people : you will need to create a remote repository accessible to these other people.
your intention is to work on an existing project : you should start by cloning this existing project, and find some way to move your work on this clone.
You generally get a repository with a remote copy when you start out by cloning a existing repository, e.g :
# this will create a local 'project/' repository,
# with all the history of the remote project,
# and, by default, git will keep the information :
# "'origin' is a shortcut for https://github.com/user/project"
git clone https://github.com/user/project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With