Tomáš Zato
Tomáš Zato

Reputation: 53129

How can I make an inital push in my new repository?

I have created a new repository on github:

new repository

I clicked button to sync it with my PC (Windows):

github web UI

The .git folder appeared somewhere else than I wanted (nobody asked me actually):

.git folder on wrong place

So, according to this answer, I cut the folder and pasted it wherever I wanted. Then I restarted the Github GUI. After playing around I discovered it doesn't work any more it did hlaf a year ago: It doesn't do anything but also doesn't tell you what's wrong. I just see this forever:

.git UI stuck when publishing

I really need to set this up, so I didn't give up and started the Powershell console instead. The console is also very funny, as every command takes more than 1 second to execute. But at least it communicates with me:

I navigated to the project folder:

C:\MYSELF\programing\unity\PROJECT_NAME [master]> git commit
On branch master
nothing to commit, working directory clean

This is confusing - I have no files uploaded, yet it claims that there's nothing to do. So I tried to configure the target for the repository and pasted this command:

git remote add origin https://github.com/USER_NAME/PROJECT_NAME.git
fatal: remote origin already exists.

Again, no success.

What should I do? Why is GitHub setup so comlicated? What am I missing to make it easy thing?

Upvotes: 0

Views: 1015

Answers (1)

DanielM
DanielM

Reputation: 1053

Getting changes from your local directory into the remote repository involves three steps

  1. Stage the changes using git add <file>
  2. Commit the change using git commit
  3. Push the change up to GitHub using git push

The message you are getting (nothing to commit) means that there are no staged changes (step 1).

Note that after step 2 the change will be in your local history but not in the remote repository. This is a common gotcha as the meaning of 'commit' deviates from the naming commonly used in tools like svn.

Upvotes: 1

Related Questions