How to Push Project Back to Fork “origin” in GitHub

I need help. This is the first time that I use Git Bash and GitHub.

I have successfully forked a project in GitHub and cloned the project to my local drive: C:\Users\my_local_name under which the Git Bash created a directory with a name that is identical to that cloned project in GitHub, which is vlerdas-subscribe.

  • Add line break to git commit -m from command line
  • git clone - how do I supress the “You appear to have cloned an empty repository” warning?
  • What does the shell script in git-stash mean and how does it work?
  • fixing the git rebase
  • Git blame a list of authors in a file
  • Problems with virtualenvwrapper
  • Now, I have completed all the changes made to the project on my local drive. When I issued a push command using Git Bash at
    my_local_name@machine_name ~ (master)
    $ git push origin master

    I get
    fatal: ‘origin” does not appear to be a git repository
    fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

    When I issued a push command at
    my_local_name@machine_name ~/vlerdas-subscribe (master)
    $ git push origin master

    I get
    fatal: could not read Username for ‘https://github.com’: No such file or directory

    Where did I make mistakes? Here are the steps taken by me to fork and clone a GitHub project:

    1. Go to GitHub and select the project of my interest, which is vlerdas-subscribe

    2. Fork the project by clicking the Fork button (I created my GitHub username/password )

    3. Clone the fork into the current directory in my machine using Git Bash.

    my_local_name@machine_name ~
    $ git clone https://github.com/my_GitHub_username/vlerdas-subscribe.git

    1. To keep track of the original repository, I added another remote named “upstream”:

    4.1. I Change to the current directory in my machine

    my_local_name@machine_name ~
    $ cd vlerdas_subscribe

    4.2. Assigns the original repository to a remote called “upstream”

    my_local_name@machine_name ~/vlerdas-subscribe (master)
    $ git remote add upstream URL_Link_to_the_GitHub_project.git

  • Egit shows all files as changed
  • Using `git --git-dir /path/to/git pull /path/to/other/bare-git master` doesn't automatically update the working tree. Why not?
  • Duplicated file with different case in git origin (bitbucket)
  • How to Reorder Commits (rebase) with TortoiseGit
  • How can I access one Git repo from two machines?
  • Is there a way to commit changes to multiple branches without stashing?
  • 2 Solutions collect form web for “How to Push Project Back to Fork “origin” in GitHub”

    thanks for your kind reply.

    I have tried both of your suggestions. I still cannot successfully push my code back to the “fork” origin. (My attempts are shown below)

    I think the second set of commands provided by you works a little better (in my environment). When I push to code, the Git Bash says: “error: src refspec master does not match any.

    I have another question: In case that I could push my code back to the “fork”, how do I examine my new code is in the GitHub?

    MY ATTEMPTS:

    After I entered the first set of Git Bash commands, I tried:
    git push origin master

    and I got:
    vhaiswjenlim@VACOLTJENLIM ~ (master)
    $ git push origin master
    Warning: Permanently added the RSA host key for IP address ‘192.30.252.128’ to the list of known hosts.
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    The second set of commands:

    vhaiswjenlim@VACOLTJENLIM ~ (master)
    $ git remote rm origin

    vhaiswjenlim@VACOLTJENLIM ~ (master)
    $ git remote add origin https://{username}:{password}@github.com/{username}/{project_name}.git

    vhaiswjenlim@VACOLTJENLIM ~ (master)
    $ git push origin master
    error: src refspec master does not match any.
    error: failed to push some refs to ‘https://{username}:{password}@github.com/{username}/{project_anme}.git’

    There’s a bug in the current version that does not prompt for username and password on HTTPS.

    You can try:

    git remote rm origin
    git remote add origin 'git@github.com:username/repo.git'
    

    or

    git remote rm origin
    git remote add origin https://{username}:{password}@github.com/{username}/project.git
    

    For your second error:
    You can check if your code is on Github by looking at the repo page (the Github link).

    Did you add and commit your changes before pushing?

    git add .
    git commit -m 'commit message'
    
    Git Baby is a git and github fan, let's start git clone.