I’m trying to connect a local workspace to an identical repository on GitHub. In this instance, I cannot use git clone
so I’m trying to find a work-around. I seem to be able to set the remote url fine, but normal git commands don’t work as expected for me afterwards.
To start, I ran the following commands:
git init
git remote set-url origin [my SSH clone path]
Those commands run fine and without error. When I run git remote -v
it returns the expected repo path for fetch/push and git branch -a
returns the expected list of remote branches.
But if I run git checkout -B main
it doesn’t seem to do anything. I would expect it to checkout main and create a local branch for it, but git branch
returns nothing. If I try doing git pull origin main
it says all of my local files will be overwritten (when they match the incoming pull completely). If I run git branch main
, instead of creating a new branch, I get fatal: not a valid object name: 'main'
. I’ve never had any issues using the commands mentioned with more traditionally cloned repos. Any insight or suggestions would be appreciated.
Nick H is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.