Skip to content

Instantly share code, notes, and snippets.

@katronai
Last active March 3, 2020 23:28
Show Gist options
  • Save katronai/44b690c2f1a53beb459a22c9dc3d622b to your computer and use it in GitHub Desktop.
Save katronai/44b690c2f1a53beb459a22c9dc3d622b to your computer and use it in GitHub Desktop.
Git commands
Initialize a new git repository \
`git init`
Stage files \
`git add .`
Commit messages \
`git commit -m <commit message>`
Clone remote repository \
`git clone repopath`
Add existing folder to remote repo \
`git init Project` \
`git remote add origin repopath` \
`git pull origin master`
Set local username and email
The local config file is in the project directory: \ `.git/config` \
`git config user.email [email protected]` \
`git config user.name 'myname'`
Get local username and email \
`git config --get user.email` \
`git config --get user.name`
Set global username and email \
`git config --global user.email [email protected]` \
`git config --global user.name 'myname'`
Get global username and email
The global config file in your home directory: ~/.gitconfig \
`git config --global --get user.email` \
`git config --global --get user.name`
Configure proxy \
`git config --global http.proxy http://proxy_user:proxy_password@proxy_server_url:proxy_port`
Check the currently set proxy \
`git config --global --get http.proxy`
Reset proxy and work without proxy \
`git config --global --unset http.proxy`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment