Upload files and folders on GitHUB
To upload your project or files and folder on github with files and folder on linux system you have to follow these simple steps.
- Open Console by Ctrl+Alt+T
- First make the repository (Name=RepositoryName) from your profile page-> repository tab and click on New button on github.
Open the terminal and make the new directory (mkdir NewDirectory) or create manually a new folder or directory.
Copy your ProjectFolder to this NewDirectory.- Change the present work directory to NewDirectory.
- Run the following command one by one
git init
git add ProjectFolderName
git commit -m "first commit"
git remote add origin https://github.com/YourGithubUsername/RepositoryName.git
git push -u origin master
If console window show error something like this
!
[rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/yourusername/php-oops-mvc'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
error: failed to push some refs to 'https://github.com/yourusername/php-oops-mvc'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Then run this command
git push -f origin master
after command successfully run you can check on github.com in your repository your all files and folder was uploaded successfully.
Comments
Post a Comment