Github quickstart

Here are some quick guidelines to get up and running with Github quickly.
This article assumes you are on Windows and use Visual Studio for coding, but it could very well be another OS or IDE.
Create an account first at Github.
Create a new repository.

Download and install Git here and install according to this guidelines.

Now, rightclick on your Visual Studio project folder and choose ‘Git Bash here’. We are going to generate SSH keys first.
Type:
[code]
$ ssh-keygen –C ‘barbarabarend@gmail.com’ –t rsa”
[/code]
Accept all the defaults and don’t enter a passphrase.

now type:
[code]
$ cd ~/.ssh
$ vim id_rsa.pub
[/code]

now copy all the contents of this file and paste it in the Github website under Account:

Now, navigate to your Visual Studio project folder. And type:

[code]
$ git config –global user.name "Barbara Barend"
$ git config –global user.email barbarabarend@gmail.com
[/code]

Or whatever your name is.

[code]
$ git init
$ touch README
$ git add README
$ git commit -m ‘first commit’
$ git remote add MyRemoteRepo git@github.com:YOURGITHUBNAME/test.git
$ git push MyRemoteRepo master
[/code]

Line 5 is one line!

Now the Readme file is placed in your Github repository.

So, at this point you verified that you can actually upload your codefiles to Github and it’s time to upload the whole project. But you probably want to ignore a few files and folders (e.g debug and bin and so on).
To exclude files from being posted to Github, you need to create a .gitignore file. Like this:

[code]
$ touch .gitignore
[/code]

Now, edit this file with your favorite text editor and make it look like this:
[code]
obj
bin
*.csproj.user
*.suo
*.cache
Thumbs.db

# Other useful stuff
*.bak
*.cache
*.log
*.swp
*.user
mysecrettextfile.txt
passwords.txt
[/code]

Just basically add what you don’t want to be included. Upload the .gitignore as well:

[code]
$ git add .gitignore
$ git commit -m ‘my ignored files’
$ git push MyRemoteRepo master
[/code]

Okay, now push your Visual Studio Solution to Github:

[code]
$ git add .
$ git commit -m ‘the whole she-bang’
$ git push MyRemoteRepo master
[/code]

Now what if you want to add existing code? Like the fabulous ShoeShoe app as discussed in the former blogpost?
Create a new folder for these files and start the Git bash.

[code]
$ git init
$ git remote add MyRemoteShoeRepo git@github.com:YOURGITHUBNAME/MyShoeShoes.git
$ git clone git@github.com:YOURGITHUBNAME/MyShoeShoes.git
[/code]

So this was quick and dirty, but it does the trick.

One Reply to “Github quickstart”

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: