/py_env # excludes the py_env directory
/renv
*.html # excludes all .html files
*.yml # excludes all .yml files
*.ipynb # excludes all .ipynb files
Set up a GitHub Repository
Configure .gitignore
Initializing a Git repository may encounter an error/warning if an renv or venv is already established. This is because these directories can containe thousands of files. To avoid this warning, create a .gitignore file specifying the directories and files to exclude from tracking before initializing a Git directory.
Version 1: Set up a repo on GitHub.com first
- Install Git if not done already
- Create a new project folder.
- Create a new repository on GitHub.com. Set the name, privacy level, description (optional), and then the green “Create repository” button.
- Do not navigate aways from the page as the commands listed there will be needed to configure the repository locally.
- Copy the first 4 lines.
"# repository name" >> README.md
echo
git init
git add README.md-m "first commit" git commit
Open a terminal window (Powershell, bash, etc.) and navigate to the project’s root directory.
From the root directory paste and execute the each command.
Execute the following two commands with replacing the desired GitHub or Organization’s user name and email.
--local user.name ["GitHub/Org's user name"]
git config --local user.email ["GitHub/Orgs's email"] git config
- Enter the remaining commands from the GitHub web page in steps 3-4.
-M main
git branch ://github.com/[User/Org_name]/[repository-name].git
git remote add origin https-u origin main git push
To test your repository, open the README.md file using VS Code and make some minor modifications and save it. Then click on the Source Control icon from the left hand side of the application. Use the plus “+” symbol to stage the file. Then add Message in the field. Then click on the Commit button. Finally you can click the Sync button to push the changes back to GitHub.
Version 2: Set up a local git repo first, then link it to an online.
In this verision, the first step is to set up a local git repository. Once that is set up, you can create a git hub repository on GitHub.com using the steps outlined above. The point of departure is to then use the provided lines of code in the second set of commands to copy paste into a terminal.
git init--local user.name ["GitHub/Org's user name"]
git config --local user.email ["GitHub/Orgs's email"]
git config
://github.com/[User/Organization]/[repository-name].git
git remote add origin https-M main
git branch -u origin main git push