Skip to main content

GIT: Working With Remote Repositories

Connecting To Remote Repository

This is one of those things that I find myself looking up constantly no matter how many times I do it. So here we are.

These instructions are assuming that you have already initialized a repo on your local machine/server where you are working.

Then you will go to Github (or your repo of choice) and create a repo there as well.

The next step is to link them together. Github has a handy screen that pops up and remains visible until you have pushed your first commit. We are looking for the instructions highlighted below in red.

git remote add, git push

However there is a catch to this. All of your local changes must be committed before you can make your first push. If you have not committed all of your local changes first you will receive the following error.

push error

error: src refspec master does not match any

This is an annoying error because it does not really convey what you have done wrong. But it means that you have to commit all your changes before you can push. After you have done that you will have success.

push success

Saving Credentials To Remote Repository

It can be tedious to be manually entering your username and password every time you push to the remote. Follow these instructions to store your credentials so you don’t have to do that. Run:

git config --global credential.helper store

then

git pull

You will be prompted for credentials. Enter them one last time and they will be stored.

More on this can be found on this StackOverflow article:

Stackoverflow:How To Save Username and Password In Git

Comments

Recent Work

Free desktop AI Chat client, designed for developers and businesses. Unlocks advanced model settings only available in the API. Includes quality of life features like custom syntax highlighting.

Learn More

BidBear

bidbear.io

Bidbear is a report automation tool. It downloads Amazon Seller and Advertising reports, daily, to a private database. It then merges and formats the data into beautiful, on demand, exportable performance reports.

Learn More