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 https://github.com/xahlee/xah_emacs_init.git

# 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.

git

  1. Install git
  2. Git Basics
  3. Git Ignore File
  4. Commit Files
  5. Push to Server
  6. Pull from Server
  7. Find Difference
  8. View Log
  9. Revert Change
  10. Branching
  11. Temp Save: git stash
  12. What's HEAD
  13. FAQ