How to use git push - Git Remote Branch


How to commit a change to remote repository?

First, cd to the local project directory.

git push url

This will push your local repository to the remote git server.

Associate a Name with a URL

Typing a URL everytime is tediouos. So, there's a way to associate a name with a URL, and make the name as default. So, you just type git push and it'll be pushed to the default remote server.

Use git remote add to associate a name to the remote server address.

# cd to your project dir

cd ~/git/project_init/

# associate a name to a remote server, for the git project of current dir

git remote add gh https://github.com/project/project_init.git

# push code to the url associated with the name “gh”

git push gh