skip to Main Content

I’d like to mention that I work with WSL (Windows Subsystem for Linux). Like I mentioned above, I was a contributor on a repository that later on, was either deleted, or I was removed from. I have the code on my computer, and I want to push it to a new github repository. I dont know how to do that.

Github does give you the option to upload files, but not entire folders, and I’m not sure how to upload things like the entire node_modules folder and its countless subfolders there. Please help this is incredibly frustrating.

I tried to upload files but quickly realized I won’t be able to upload the entire folder structure. Then I downloaded Github’s desktop client to try to make a repository out of the local folder itself, but it tells me that another user on my PC has access to this repository and hence I can’t create another one out of it.

Another thing I tried was copying the entire repository folder from the WSL file system to my Desktop, which didn’t work either. It just wouldn’t copy all files. About a dozen files couldn’t be moved.

2

Answers


  1. If you create a new repository on GitHub, then they will walk you through how to upload an existing repository’s contents. (Don’t create a README in GitHub’s interface until after you’ve pushed old code, if ever.)

    Login or Signup to reply.
  2. The steps are:

    • create a new empty repository on Github (without a README as Jim Redmond said in his answer, but it is not a big problem if you have that first commit on your github repo)
    • make your local repository point at that new repository:
    # the same url you get when you copy the "Clone" url:
    git remote set-url origin https://github.com/<yourname>/<yourrepo>
    
    # that or the ssh url:
    git remote set-url origin [email protected]:<yourname>/<yourrepo>
    
    • run git push origin main (to push just the main branch) or git push origin --branches (to push all branches)

    if you get an error on push, this is probably because you created that "README" file in your new repo, just run git push --force ...

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search