Git
Git is a distributed version contol system that is widely used to source code management
Set up your account name and email address¶
You can specify Git configuration settings with the git config command
## replace Nancy and Nancyteach@example.com with your username and email address.
git config --global user.name "Nancy"
git config --global user.email "Nancyteach@example.com"
To check your configuration, run the following command:
git config --global --list
2. Update Remote Repo¶
Clone a remote repository to local computer¶
git clone <repository_url>
Update remote repository¶
Push change in local repository to remote repository (* do not include empty files (file size is 0) otherwise cause error) from step 1 - 3
- To add files to the staging area, run the following command:
git add .
- To commit the changes, run the following command. Repalce message with your comment to this commit
git commit -m 'message'
- Push the change from local repository to remote repository
git push
4. Git large files¶
The image below indicated that file 'docs/app.json' exceeds file size limit, please follow below steps to resolve it.
The error message: File docs/app.json is 341.24 MB; this exceeds GitHub's file size limit of 100.00 MB
- Use below command to see which files are causing the push failure
git lfs migrate info
- Git regular file limits the file size to 100 MB. So pull out the file over than 100 MB from history and store it in Git Large file.
git lfs migrate import --include="*.json"
git lfs migrate import --include="*.data"
- push the change
git push
You may have another error is relate to URL returned error. Then please use below command to increase buffer size¶
git config --global http.postBuffer 157286400
Authentication error¶
The error message indicates a permission issue when trying to push to your Github repository.
- Using personal access token (PAT) instead of your GitHub password
- generate a personal access token
- go to github settings
- Navigate to Developer settings > Personal access tokens > Tokens (classic) > Generate new token
- Update Git remote url
replace the password in your git remote url with the PAT you just generated - git remote set-url origin https://your-token@github.com/OWNER/REPOSITORY.git - Owner: your github user name - REPOSITORY: the name of the repository that you want to update
Thanks to Tanner Honnef for providing the solution!