How to set up your github repository in Ubuntu

Setting up on Ubuntu

Creates a new ssh key using the github email address:

Then copy it to the clipboard:

Then go to https://github.com/account/ssh and click “Add another public key” and paste the clipboard and press “Add” Key”.

And now try to connect to github to see if everything is working:

If everything goes fine you should have something similar:

Then you should install git (it should be already installed by default):

Now you can configure git:

Now get your token at GitHub -> Click “Settings” > Click “Personal Access Token”

You can create a github repository and clone locally.

 

How to add existing project to GitHub

Here is how you add an existing project to Github without cloning it first. One quick option is to create the repository on Github, clone it locally and then copy all the files across.

Go to your project

Initialize the repository:

You should see the following message:

Add all your files to the repo:

Check to see that there are changes to be committed:

You should see something like this:

In this case, my_project.info and my_project.module are the files I have in my project.

Commit the files.

Go to Github and create a new project repository and get the repo url: https://github.com/itabara/hello-world.git

Add Github as remote origin

Now we need to push our changes to Github.

Add this as the remote origin:

Pull from Github to local:

And finally, push the code to Github:

Additional references: