Vicky Rampin
Vicky's ORCID: 0000-0003-4298-168X
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Let's get on the command line and start!
When the terminal is open, type the following as separate commands:
git config --global user.name "Vicky Rampin"
git config --global user.email "vicky.rampin@nyu.edu"
git config --global color.ui "auto"
git config --global core.editor "gedit"
git config --list # lists your configurations
Where it says core.editor, put in your favourite plain text editor. This could be simply Notepad (Windows) or TextWrangler (Mac), but NOT Word.
Git calls copying a remote repository to your local computer cloning. Person B: clone person A's repository:
cd Desktop # or wherever you want to put the repository
git clone LINK
cd repository-name # go into your new repository
To get the link, click the big green button in the repository on GitHub & make sure you select it with HTTPS:
Type the following as separate commands:
git add README.md
git status
We are telling git that we want to track any changes we make to our REAMDE -- so we use git add
. This adds the README file to the staging area (where git checks for file changes).
You should see something that looks like this:
The filename README.md
should be green now, which is git visually cueing us to the fact that there is a new file waiting for us to commit to it!
Let's commit so Git officially records this as our changes!
git commit -m "updated license info"
git status
You should see something that looks like this:
We now have a permanent record of what was changed, along with who made the commit and at what time.
When working locally, you'll usually always follow this flow:
Now that we made some changes to our repository locally, we need to make sure our partner has access to those changes too! For this, we add one command to our flow, git push
, which pushes our local changes to GitHub or wherever we are hosting our git repository!
git add -A # shortcut to stage all your files
git commit -m "descriptive msg" #add a new file to the repo
git push origin master # send these changes to the central repo
Go refresh your browser to see your changes!
So Person A has cloned the repo, made changes, and pushed back the central repo. What if Person B also wants to keep their local copy in sync? Then, they use git pull
to download the new changes!
git pull origin master
Then navigate to your own local copy to see the new changes!
In this lesson, you have:
Git
GitHub
Email me: vicky.rampin@nyu.edu
Learn more about RDM: guides.nyu.edu/data_management
Get this presentation: guides.nyu.edu/data_management/resources
Make an appointment: guides.nyu.edu/appointment
Vicky's ORCID: 0000-0003-4298-168X
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.