You are a developer and creating a sample projects for your learning or for samples that can help you in future. Then why you don’t upload your github/bitbucket. Follow the below steps to upload your project on git/bitbucket.
Upload Project on GitHub – How to add existing project to GitHub or Bit-bucket
Create account on github or bitbucket.
Create new respository on github or bitbucket. So you will get a http clone url with .git extension.
Now come to your local directory/project that you want to upload on git.
Open directory in terminal.
cd /path/to/my/repo
Init you project as git repository by following command.
git init
Connect this repository to remote git repository.
git remote add origin [//your github url]
Add all your folder and files of project to version control system by following command.
git add .
commit all your changes that you have added files and folder.
git commit -m 'First Commit'
Upload/push code to remote git repository.
git push -u origin master
It will ask for password for your git account. Enter it. Done !!
Note : Github “Updates were rejected because the remote contains work that you do not have”
This happens if you initialized a new github repo with README and/or LICENSE file
git remote add origin [//your github url]
//pull those changes
git pull origin master
//now, push your work to your new repo
git push origin master
git remote add origin [//your github url]
//pull those changes
git pull origin master
//now, push your work to your new repo
git push origin master
Now you will be able to push your repository to github. Basically, you have to merge those new initialized files with your work. git pull fetches and merges for you. You can also fetch and merge if that suits you.
Your Identity
The first thing you should do when you install Git is to set your user name and email address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
Again, you need to do this only once if you pass the --global option, because then Git will always use that information for anything you do on that system. If you want to override this with a different name or email address for specific projects, you can run the command without the --global option when you’re in that project.
Many of the GUI tools will help you do this when you first run them.
No comments:
Post a Comment