0

I have an existing repository on GitHub. It's private, so I'm sorry I can't provide the URL as part of this question. I have some code in a folder. This folder does not have a .git folder. I want to "connect" or "link" this folder with a remote repository. I'm using this documentation.

Everything goes fine up to step 4. Then I get this error:

% git init -b main
error: unknown switch `b'

What am I doing wrong here?

Paul Reiners
  • 8,576
  • 33
  • 117
  • 202

1 Answers1

5

You could just go with this:

# Initialize a git repo on current folder
git init .

# Stage all objects in current folder (including subfolders)
git add .

# Commit git changes
git commit -m "First Commit"

# Add a Remote Git Repo
git remote add origin https://github.com/xxxx

# Finally push changes from local repo to remote repo
git push origin main
ShengHow95
  • 236
  • 1
  • 5