12

I just installed rails on an Ubuntu machine. I set up git and made an ssh key to link to my account. I made a repository to commit to, and made a sample project to test with called first_app. When I make commits it says it was all committed, but I go to github and it isn't there. I want to put my project up there, but it doesn't have the connection for some reason. I've googled around and I'm not seeing anything so it must be some stupid thing I did. Is there a way I can check that everything is configured right?

Edit: Tried to set the remote address, but it was already right. It has the correct URL.

Edit2: Here is what came up in the terminal:

jonny@MM061-JD:~/first_app$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = git@github.com:JonnyDoeInWisco/first_app.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
jonny@MM061-JD:~/first_app$ git remote -v
origin  git@github.com:JonnyDoeInWisco/first_app.git (fetch)
origin  git@github.com:JonnyDoeInWisco/first_app.git (push)
JonnyDoeInWisco
  • 233
  • 1
  • 4
  • 12

3 Answers3

11

You have to push your commits from your local repository to the remote repository:

$ git commit -m "your commit message"

$ git push origin <branch_name>

Substitute <branch_name> with the remote branch you are pushing to (i.e. master branch would be $ git push origin master).

Without pushing your commit, you should see a similar message when you run:

$ git status

Git will tell you that you have commits that you need to push to your remote.

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

Verify your remote repositories

If you are seeing an up-to-date status with your remote, you should verify you're actually pushing to the location/repo that you think you are:

$ git remote -v
Thomas Stringer
  • 5,682
  • 3
  • 24
  • 40
2

You need to push your commits.

Try:

$ git push origin master

The reason for this, is because when you make a commit, it actually just commits to your "local repository".

Read more on the difference between commits and pushes.

Community
  • 1
  • 1
ddavison
  • 28,221
  • 15
  • 85
  • 110
1

With Git, you have to commit then push your changes. A commit is a local operation, while pushing actually sends your file to the remote repository.

alcfeoh
  • 2,147
  • 1
  • 18
  • 33