How to link existing local source with NO local git repo to a remote git repo

Kind of a long story, but here’s the deal:

on GitHub:

  • Android Studio Project says project is already on GitHub despite the fact I deleted repository.
  • Is there a way of pushing to a forked repo without cloning all its content to local computer?
  • .gitignore is ignoring other directories with the same name
  • Git Diff to Perforce?
  • Is it possible to flag certain files to never cause merge conflicts in Git?
  • Version control for large php/mysql web application
  • a repo that I downloaded the source code from (just via a zip, not by cloning it)
    a fork of that repo that I was going to push changes to.

    on my local machine, I unzipped the master repo’s source code that I downloaded and did some work on it.

    Now, I’m in the situation where I want to push these changes back to the remote forked repo, but since I didn’t set up the repo locally when I first got the source code, I’m not sure what to do.

    Any help?

    Thanks

    Mustafa

  • How to pull request a wiki page on GitHub?
  • How to create reflogs information in an existing bare repository
  • Broken references in a cloned git repo
  • SourceTree and Stash: Unable to get local issuer certificate
  • Why does git help add “git-” before every command name?
  • File backing store for Jazz RTC? Database or file based?
  • 4 Solutions collect form web for “How to link existing local source with NO local git repo to a remote git repo”

    Clone the repo the proper way.

    From the cloned repo, do:

    GIT_WORK_TREE=../test.wd git commit -am  "Commit from work tree"
    

    ( you will have to add files if you have added new one: GIT_WORK_TREE=../test.wd git add )

    where ../test.wd is the path to the working directory where you had unzipped and done your changes

    Now, git push origin master

    Alternatively, you can just copy files over to the clone and commit and push.

    1. clone the project (in another directory than your zip extracted directory)
    2. copy the contents of the zip extracted directory (with your modifications)
    3. paste it over the contents of the cloned project
    4. commit the changes
    5. push to remote

    If your changes are relatively minor, just checkout the remote repo into a local repo, then apply your changes on top of it as a single commit, or over a series of reasonably-demarcated commits if necessary.

    Simply add the remote repo as origin

    git remote add origin <repo url taken from github>
    

    I am unsure if that sets everything up the way that git does from the beginning but it should be sufficient to be able to push

    Git Baby is a git and github fan, let's start git clone.