Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (44 sloc) 2.97 KB
To check first if you’ve already configured Git type
>> git config --list
if nothing comes up it means nothing is configured. The only two things you really need to set are your name and email address. These can be set with the following Terminal commands, note replace YOUR NAME and YOUR EMAIL with the correct information:
>> git config --global user.name "YOUR NAME"
>> git config --global user.email "YOUR EMAIL"
>> git config --list
---------------------------------------------
setting up the local repo
>> git init
---------------------------------------------
add files to the local repo
>> git add making.folders.R (and subsequently for all files)
Notice how Git says changes to be committed? The files listed here are in the Staging Area, and they are not in our repository yet. We could add or remove files from the stage before we store them in the repository.
---------------------------------------------
once you are ready to commit the files, these are "staged" for addition
To store our staged changes we run the commit command with a message describing what we've changed. Let's do that now by typing:
>> git commit -m "comment"
---------------------------------------------
So we've made a few commits. Now let's browse them to see what we changed.
Fortunately for us, there's git log. Think of Git's log as a journal that remembers all the changes we've committed so far, in the order we committed them. Try running it now:
>> git log
---------------------------------------------
Created a new empty GitHub repository to store the project. such as: https://github.com/patternproject/r.ikmc.proj
To push our local repo to the GitHub server we'll need to add a remote repository.
This command takes a remote name and a repository URL, which in this case is https://github.com/patternproject/r.ikmc.proj
Go ahead and run git remote add with the options below:
>> git remote add origin https://github.com/patternproject/r.ikmc.proj
---------------------------------------------
do a pull before doing a push
>> git pull origin master
you will be prompted for comments, simply add "first pull for synching up rstudio"
---------------------------------------------
The push command tells Git where to put our commits when we're ready, and boy we're ready. So let's push our local changes to our origin repo (on GitHub).
The name of our remote is origin and the default local branch name is master. The -u tells Git to remember the parameters, so that next time we can simply run git push and Git will know what to do. Go ahead and push it!
>> git push -u origin master
it will prompt you for username and password, for git
---------------------------------------------
14. git menu in rstudio does not work, when ever you want to make changes to the remore repo
a) > git status
b) > git add <changed file name>
c) > git commit
(enter changes for commit)
d) > git push -u origin master
(prompted for login and password)
You can’t perform that action at this time.