Create a github account with username and password .
When you want to make a folder as git repository, associate that repository with the corresponding github account by adding the same username and password.
To push an existing repository
Go to var/www/html/project-folder
git init
git config --global user.name "Your Name"
git config --global user.email "Your Email"
--------------------------------------------------------
git config --list
to check current username & email
- Change username & email as desired. Make it a global change or specific to the local repo:
git config [--global] user.name "Full Name"
git config [--global] user.email "email@address.com"
- Per repo basis you could also edit
.git/config
manually instead - -------------------------------------------------------------------------------------------------------------
create github repository
Add local machine ssh key to your github settings ssh
git remote add origin git@github.com:dawnStreaks/github_repo_name.git git add . //to add all filesgit commit -a
m “adding new project”
//
t
git push origin master Please make sure you have the correct access rights
----------------------------------------------------
in case of any errors remove the remote origin, then reset it in the following way:
-----------------------------------------------------------------------------------
git remote rm origin
git remote add origin https://USERNAME:PASSWORD@github.com/username/reponame.git
or
git remote add origin git@github.com:username/reponame.git
References:
https://www.atlassian.com/git/tutorials/syncing/git-pull
No comments:
Post a Comment