Git: Push to Server

By Xah Lee. Date: . Last updated: .

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/xah_emacs_init/

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

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

If you have a question, put $5 at patreon and message me.