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:

  • Shell script helper for git commits
  • intellij idea: how to disable pre-commit code analysis for Git-backed projects
  • Good way of organizing git repository of multiple projects
  • How to recover last commit after git hard reset?
  • Git “does not appear to be a git repository” ip and port instead of domain?
  • bash __git_ps1 command not found
  • 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?



  • How to revert a 'git filter-branch -f --env-filter'
  • How to list all tags pointing to a specific commit in git
  • Command to get latest git commit hash from a branch
  • Best practice for translating git versioned documents
  • Conflict between branch and file completion in bash/git
  • GIT HTTPS connection issue
  • 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.