Question 1: When attempting to push to github git push -u origin master appears
error: failed to push some refs to '[email protected]:519ebayproject/519ebayproject.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
The reason : local and remote repository different, need to merge (such as: the initialized when github repository is created, you put a local repository associated with it and want to push, it must first github repository and the original merger)
Solution :
Command (assuming your name is the remote repository origin)
git pull origin master
Use git pull the latest changes from local to remote storage Kula repository.
Question 2: git push every time you need to enter a user name and password
The reason : the use of the code is submitted https mode, create the repository with
git remote add origin https://github.com/user/repo.git
Solution : If the only way to add a ssh key user of sha in the repository can be achieved without the need to enter a user name and password submission.
Step 1: Create a repository use the following method:
git remote add origin [email protected]:(用户名)/版本库名
E.g:
git remote add origin [email protected]:michaelliao/learngit.git
Step 2: After you need to create SSH Key (if previously added in the past github, you can ignore this step), the reference Liao Xuefeng teacher
Step 3: Submit the code has not logged in
git push -u origin master