Assuming you are ready with your project directory and wanted to push into your github repository.
- Initialize directory with git
git init -b main
- Add to staging and perform commit
git add . && git commit -m "intitial Commit"
- But you are unable to push the changes. You need to create the repo before pushing. You can perform this using cli.github.com
- Install gh into your machine
sudo apt-get install gh
- Then create repo using command
gh repo create
- Oops! is it asking for authentication. haha :) stay conscious. Now run the command and specify required feilds
gh auth login
- Rerun step 5. Specify Repo name, Desc, Visibility, and if you want to a remote name it something like
origin
. It initializes push commits to origin. - Thats it. You are done. But is that really help in all cases? If yes end your reading here and if not you might faced the same thing what I've faced.
exceeds GitHub's file size limit of 100.00 MB
Usage of git-lfs
Ofiicial docs: git-lfs.github.com
Installation
sudo apt install git-lfs
Track files
git lfs track "*.pkl" "*.csv"
Add .gitattributes
git add .gitattributes
Add files to stage and commit
git add . && git commit -m "large_files"
Push the changes to branch
git push origin -u main
failed !
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/Username/project.git'
Googling got me through this: stackoverflow.com/questions/33330771/git-lf..
Try migrating large files
git lfs migrate import --include="*.pkl"
git lfs migrate import --include="*.csv"
and push to git.
git push origin -u main
I'm done with my requirement and hope the same with you. ๐ง๐ค
If not google is your saviour. Thanks for reading till the end. Bye ๐
ย