Setting up git for a project

Sat, 09/29/2018 - 13:19

Configure Git for local projects

First your info:

git config --global "First Name Middle Name"
git config --global ""


Change "Origin" of your git Repo

git remote rm origin
git remote add origin 
git config master.remote origin
git config master.merge refs/heads/master


Create a new repository

git clone
cd personal-budget
git add
git commit -m "add README"
git push -u origin master


How to delete multiples files in a repo

The way for editing or deleting multiple files is by working with a local repository. You would then be able to delete the files in your local clone, commit that change to your local repository, and then push that change to the remote repository.

git checkout master
git rm -r folder-name
git commit -m "Remove duplicated directory"
git push origin master


Existing folder

cd existing_folder
git init
git remote add origin
git add .
git commit -m "Initial commit"
git push -u origin master


Existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin
git push -u origin --all
git push -u origin --tags


Cloning an existing repo

When a repo is cloned it is not necessary to execute the command "git init", the git files come inside the folder that creates the command when you are cloning the repo. The ".git" folder exists inside the project folder


Errors in Git

Sometimes errors just happens, you really can't do anything for avoid it, here a list of common error and how you can fix it:


No Error Message Error Solution
1 error: Your local changes to the following files would be overwritten by checkout:
Please commit your changes or stash them before you switch branches.

Reset the git repo with this command: 

using git reset --hard

using git reset --hard

Mexico City

Today, March 23, 2019
Sunrise: 06:37
Sunset: 18:48


73 °F / 23 °C