RoPod/Tutorials/Configuring GitHub: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
No edit summary
Line 20: Line 20:
<pre>git config --global user.name "USERNAME used in GitHub"  
<pre>git config --global user.name "USERNAME used in GitHub"  
git config --global user.email "Mail_used_in_Git_Hub@domain.com"</pre>
git config --global user.email "Mail_used_in_Git_Hub@domain.com"</pre>
Add the ROPOD test branch repository to your GIT
<pre>git remote add origin https://github.com/tue-ropod/ropod-project.git</pre>


Create the ropod folder, which will be common on all laptops to keep the integration process smoother (Later we might find a way to not require this):
Create the ropod folder, which will be common on all laptops to keep the integration process smoother (Later we might find a way to not require this):
Line 31: Line 27:
Set write permissions:
Set write permissions:
<pre>sudo chmod 777 /home/ropod</pre>
<pre>sudo chmod 777 /home/ropod</pre>
Switch to the newly created folder:
<pre>cd /home/ropod</pre>
Initialize a git repository:
<pre>git init</pre>
Add the ROPOD test branch repository to your GIT
<pre>git remote add origin https://github.com/tue-ropod/ropod-project.git</pre>


Then clone the repository and switch to the testbranch for this tutorial
Then clone the repository and switch to the testbranch for this tutorial


<pre>cd /home/ropod
<pre>
git clone --branch InittestBranch https://github.com/tue-ropod/ropod-project.git
git clone https://github.com/tue-ropod/ropod-project.git
cd ropod-project
git checkout InittestBranch</pre>
git checkout InittestBranch</pre>



Revision as of 10:49, 30 March 2017

In order to keep track of the changes made within the software of the entire project (so we know who screwed up :)) and have the ability to revert a the software to a previous revision, we are using version control. We will use GitHub for this. Every team member has the full history available, and can always stored his changes and go back to previous versions, even if he or she is off-line. However, note that we will use a central server every team member stores his or her changes to, and loads the changes others made from.

Get familiar first with Git repositories https://git-scm.com/doc, and the used concepts: i.e. branches, commits, push, etc.

Create an account in guthub https://github.com/, it will allow you to do changes to the repository

Install Git in your system: https://git-scm.com/downloads

 apt-get install git 

At this point you might want to follow this tutorial to get hands on experience on how a repository works: https://git-scm.com/docs/gittutorial. For now you can also continue to get a quick example on how to comit files.

Example

Configure git in your laptop

git config --global user.name "USERNAME used in GitHub" 
git config --global user.email "Mail_used_in_Git_Hub@domain.com"

Create the ropod folder, which will be common on all laptops to keep the integration process smoother (Later we might find a way to not require this):

sudo mkdir /home/ropod

Set write permissions:

sudo chmod 777 /home/ropod

Switch to the newly created folder:

cd /home/ropod

Initialize a git repository:

git init

Add the ROPOD test branch repository to your GIT

git remote add origin https://github.com/tue-ropod/ropod-project.git

Then clone the repository and switch to the testbranch for this tutorial

git clone https://github.com/tue-ropod/ropod-project.git
cd ropod-project
git checkout InittestBranch

Check the online repository, for now mostly only readme files: https://github.com/tue-ropod/ropod-project/tree/InittestBranch

Now, suppose you want to add a file. You can make a test by creating a test file and add it, commit it and push it into the repository:

cd ropod-project/documentation/reports
echo "My first test file to add, commit and push into the repository" > YOURNAME_testfile.txt

You have created the YOURNAME_testfile.txt, which you will add to version-control:

git add YOURNAME_testfile.txt 

Now the file is added to version control but is not committed yet, run:

git status

and you will be able to see that the file was added and not committed yet. You can indeed add more files if desired. Next, commit the file:

git commit -m "Here you can add a comment to this commit, i.e. commit test "

Always try to put a meaningful comment in the message field of your commit. In this way other people know what is your commit for. By the way, after three months it could be really useful for yourself as well! Now run again:

git status

Notice that there is nothing to commit but you received the message that your branch is ahead of ‘origin/InittestBranch’, which is the branch we are using in the online repository.

git push -u origin InittestBranch

You will be prompted the username and password created in the github website. Now, if you check the online repository at https://github.com/tue-ropod/ropod-project/tree/InittestBranch you should see your file online.

As it is impossible to work without Matlab, lets install it now.