This guide describes a quick way to setup github on an ubuntu machine. Please check the corresponding class websites for additional contact information.
1. After creating an account, go to the create repository screen:
2. In the next screen, set the repo name, set it to private, and for quick initialization, check "Initialize repository with a README" and create the repo.
1. This is what it should look like, copy the link in the blue circle.
2. In the terminal, type "git clone copiedlink":
>> git clone https://github.com/Fiofou/cs371p-test.git
This creates a folder with the repo on your machine.
>>@prakash: ls
>>@prakash: s371p-test
Here is where you can work in and have your github updated.
>>@prakash: cd cs371p-test/
>>@prakash: ls
>> README.md
As you can see, this is where the README.md from the online repo was downloaded.
1) I made a small Hello World kind of program, in your case, work on your assignment:
@prakash: gedit test.c++ &
[1] 4138
lara@prakash:/v/filer4b/v38q001/lara/cs371p/test/cs371p-test$ g++ test.c++ -o test
lara@prakash:/v/filer4b/v38q001/lara/cs371p/test/cs371p-test$ ./test
Hello cs371p!
2) The git and the github are not updated, though. First, we have to tell git what files we want to add to its repository:
You can do:
>> @prakash: git add file1 file2
Or, to add all files from the current folder (which I used for this example, and can be useful when handling lots of files):
>> @prakash: git add .
3) Then you need to commit your changes. Here is where you can select a message for the commit:
lara@prakash:/v/filer4b/v38q001/lara/cs371p/test/cs371p-test$ git commit -m "First commit: prints out hello."
Followed by a bunch of status messages:
>>[master 06bd018] First commit: prints out hello.
>> 3 files changed, 14 insertions(+)
>> create mode 100755 test
>> create mode 100644 test.c++
>> create mode 100644 test.c++~
4) Now that the changes are commited, you can push them to the github, and they'll appear online.
>> prakash: git push
Again followed by a bunch of status messages. It will prompt you for your github username and password though. This can be changed so that your password is cached for a certain duration(for https) or you can add your SSH key in github.com so it will push without authenticating.
>> Username for 'https://github.com': Fiofou
>> Password for 'https://Fiofou@github.com':
...
>>To https://github.com/Fiofou/cs371p-test.git
>> c0759fc..06bd018 master -> master
5) This is the end result, as you can see https://github.com/Fiofou/cs371p-test. Happy programming!: