1

I have committed and pushed several changes for a project using git on the command line, but when I log in to GitHub, the branches and commits I made are not shown on my account. Why?

I can review all commit history I have made using git on the command line.

Results of git remote -v command

origin  https://github.com/felixtan/guessing-game.git (fetch)
origin  https://github.com/felixtan/guessing-game.git (push)
photon
  • 606
  • 4
  • 14
  • 31
  • 1
    Have you added github as a remote? From the command line try `git remote -v` and post the results into the question. – shuttle87 Jun 08 '14 at 02:12
  • Is it your repository? What did it say when you tried to `git push origin ` for whatever you called your branch? – Leigh Jun 08 '14 at 02:35
  • Make sure that if you're using a non-default branch, you mark it as tracking first with `git push ORIGIN_NAME BRANCH_NAME -u`. – Nick McCurdy Jun 08 '14 at 02:56

1 Answers1

4

Once committed locally, you still need to push those commits to github:

git push

(since your remote is named origin, you don't need to specify its name: it pushes by default to 'origin')

This assumes you are the owner or one of the collaborators of the repo felixtan/guessing-game.

If it is the first time you push your current branch:

git push -u origin yourCurrentBranch

That establish a tracking relationship between your branch and 'origin/yourBranch', as detailed in "Why do I need to explicitly push a new branch?".

Once that first push is done, the subsequent pushes are simple 'git push'.


If you are not the owner/collaborator, you won't have the right to push to that repo.

You need to make a fork (See GitHub forking), and in your local cloned repo you are already working on:

git remote rename origin upstream
git remote add origin https://YourLogin@github.com/YourLogin/guessing-game.git

That way, you will push to your fork (that you own), and will make pull requests from there (See GitHub pull requests).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250