ling
ling

Reputation: 205

how do I link github and Rstudio when I see Untracked files?

I am new in github. I want to use version control and create GitHub repository and clone one in my Rstudio, so I did following steps in terminal ( MAC): 1. pwd /Users/wulingqi

  1. cd ~/Documents/R/temporary

  2. git commit -m "initial commit" Now, I can not create new file but get this: On branch master Initial commit Untracked files: .Rhistory .Rproj.user/ nothing added to commit but untracked files present

  3. And then I paste code from GitHub website, paste and refresh, but no change in the website: git remote add origin https://github.com/lingqi-w/temporary.git git push -u origin master

Could someone give me some advice on this? Thank you.

Upvotes: 0

Views: 372

Answers (1)

Thosar
Thosar

Reputation: 115

If you use the terminal, you need to stage the files you want to commit. This holds for both untracked and modified files. You can stage files by using:

git add [path_to_file]

Use git add . to add all files in your current directory and its subdirectories or use git add src/file* to add all files that have a path that start with src/file*

After that you have staged the files you want to commit, you can retry to use:

git commit -m "initial commit"

If you then want to push to github you can use:

git push origin master

Upvotes: 1

Related Questions