-3

I thought I knew all this but nothing is working. From the command line I cloned a GitHub repository. That worked fine.

But now I want to push it back up, including files I added. How do I do that? "Git add" and "git push" don't seem to be doing anything.

Here's a lot of what I tried:

C:\git\ColoradoBallot>git push origin master
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Username for 'https://github.com': david@windward.net
Password for 'https://david@windward.net@github.com':
Everything up-to-date

C:\git\ColoradoBallot>git add
Nothing specified, nothing added.
Maybe you wanted to say 'git add .'?

C:\git\ColoradoBallot>git add .

C:\git\ColoradoBallot>git push origin
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Username for 'https://github.com': david@windward.net
Password for 'https://david@windward.net@github.com':
Everything up-to-date

C:\git\ColoradoBallot>
David Thielen
  • 28,723
  • 34
  • 119
  • 193
  • 1
    Could you edit the question to contain a brief shell transcript showing your attempts to push, including the command you run and the exact error message it generates? – David Z Oct 15 '18 at 03:31
  • 2
    `git add` stages changes to be committed. `git commit` commits staged changes. `git push` propagates the commits to a remote repository. You missed a step. It would be good for you to go through a git tutorial or two, since understanding not just commands but also git "philosophy" is pretty important (as git is complex enough that leaning isolated commands will only leave you more confused). [Atlassian tutorials](https://www.atlassian.com/git/tutorials); [Github guides](https://guides.github.com/); [Someone's tutorial link collection](https://gist.github.com/jaseemabid/1321592) – Amadan Oct 15 '18 at 03:32
  • Your big problem is that you never made a commit. You need `git commit -m 'your work here'` after the `git add .` step. But, you should heed the above comment and review a tutorial. – Tim Biegeleisen Oct 15 '18 at 03:37
  • @Amadan - thank you, that was it. I usually use Visual Studio and so missed the step being in the command line. – David Thielen Oct 15 '18 at 03:41
  • Note that you don't use Git to transfer *files* (so you don't push files). With Git, the unit of operation is the *commit*. Until you commit something, Git has not frozen it forever. Once you commit something, Git has frozen all the files that were in the index at the time you ran `git commit`, in the form they had in the index. Initially, the index contains all the files from the previous `git checkout`. This index thing is also called the *staging area* or sometimes the *cache*, depending on who is doing the calling. Running `git add` copies files into the index. – torek Oct 15 '18 at 04:46

1 Answers1

1

Here, is the step to push files in GitHub:-

git add .
git commit -m "Enter your message"
git push origin <branch_name>
Razia Khan
  • 493
  • 7
  • 14