1. git remote add origin [email protected]:User/UserRepo.git
git init
.origin
is an alias/alternate name for your remote repository so that you don't have to type the entire path for remote every time and henceforth you are declaring that you will use this name(origin) to refer to your remote. This name could be anything.git remote -v
OR git remote get-url origin
2. git remote set-url origin [email protected]:User/UserRepo.git
This command means that if at any stage you wish to change the location of your repository(i.e if you made a mistake while adding the remote path using the git add
command) the first time, you can easily go back & "reset(update) your current remote repository path" by using the above command.
3. git push -u remote master
This command simply pushes your files to the remote repository.Git has a concept of something known as a "branch", so by default everything is pushed to the master branch unless explicitly specified an alternate branch.
To know about the list of all branches you have in your repository type :git branch