Wednesday, June 10, 2020

git 101

So, a bit of git 101, but not something you actually do that often: creating a new git repository, both locally and on your primary remote, from an existing folder (like maybe something created with create-react-app or similar) Like, I wasn't sure if you had to start making the remote archive, or you could push it straight to remote from local.

The answer is you kind of meet in the middle - set up the local repository, go to github and do a new repo there, then tell them about each other. This page walks you through it, but for future reference, the important thing was:
in the folder, do a

git init

then maybe a

git add .
git commit -m "first commit"

and that sets up your local repository

Then go to github, hit "New", give it the (probably same) repository name...
github then gives you the command hint you need, "...or push an existing repository from the command line":

git remote add origin
git push -u origin master

and Bob's Yer Uncle.

No comments:

Post a Comment