I started a project to do my homework for the week in the Android class I'm taking. I've been doing the bulk of my work on a desktop machine in my office. This week-end I also set up a dev environment on my Fedora laptop at home. I don't want to have to monkey with copying files and carrying them back and forth so today I set up a GitHub repo so that I could use it to keep things in sync.
I'm no git expert. In the past what I've done is create a project in github with a couple pieces in place. Then I pull that down to a directory on my machine, add the files I need and then push all that back up.
Today I took a little bit of a different approach. I created the project. Then in bash I went to the root directory of the project and set things up. It took me a minute to get it all figured out. The git reference on remotes was a huge help. There is also the JetBrains documentation on git with IntelliJ which is what Android studio is built on.
For my own reference - once I got the project built I needed to add everything. First I went to github and made a repo - but I made it empty, not like I usually do. Then I went to the root of my project in bash.
git add .
and then make an initial commit
git commit -m 'initial commit'
I set up the remote
git remote add origin https://github.com/bittercode/learnandplay.git (bittercode is my github user name and learnandplay is the name of the repo I set up.)
Then I pushed the code to the remote
git push -u origin master
And that put it all up at github. Now I should be able to go home and pull it all down there. I also set up AndroidStudio so that it now handles all the git stuff. When I created a new activity it asked me about adding them to git - so I just said that it should default to yes and now I'm on the fast track to happy days.