0

So I'm just starting to learn about Git and I'm trying to learn the relationship between the server and client. I don't want to start using GitHub quite yet. The eventual goal is to use my NAS as a server. My strategy is to create both 2 folders: "RemoteTest" and "LocalTest" folders on my local machine, which will act as my client and server.

Here's what I did:

  1. First created 2 Folders: RemoteTest and LocalTest
  2. In LocalTest, executed git init
  3. In RemoteTest, executed git init --bare
  4. In LocalTest, created new file test.txt
  5. Added "test.txt" in LocalTest using git add test.txt
  6. Committed using git commit -m "Testing 123"
  7. Added the remote location using git remote add origin ~/Desktop/RemoteTest
  8. Attempted to push content to RemoteTest using git push

Everything is good up until step 8, where I then get 2 errors:

  1. Fatal: The remote end hung up unexpectedly
  2. List item Error: failed to push some refs to 'c:/Users/Test/Desktop/RemoteTest'

What am I doing wrong? Using latest version of Git and Windows 8.1.

Thanks

  • possible duplicate of [I can't clone my repository in my own git server](http://stackoverflow.com/questions/28348518/i-cant-clone-my-repository-in-my-own-git-server) – ThanksForAllTheFish Feb 13 '15 at 10:52

1 Answers1

1

If you just do the steps you outlined, your local branch has no upstream branch, so git push won't know where to push to.

If that is the problem, simply doing git push origin master (or with --set-upstream if you want your branch to remember it) should work.

(Disclaimer, I would expect the error message to be

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

instead of your errors.)

If not, check that you actually added the remote correctly, starting with checking what git remote -v says. I don't know Windows, but your second error suggests that the remote is indeed correctly set up.

drRobertz
  • 3,490
  • 1
  • 12
  • 23