github connection

Scenario:

Code local git repository to preserve github want to submit to the above, this time you need to configure the connection to the local git github of the remote.

Creating a warehouse in github

 

 

Once created View Address 

 

 Enter a non-repository directory on the local server, clone github above the warehouse to the local

git github connected with two ways: ssh / https

Ssh under way:

keygen-SSH -t RSA -C " [email protected] "     #git client server generates the key pair, the user name of the user name github 
copy the public key to github above (step specifically shown)

https mode:

-U parameter when adding a git push command: git -u push origin master, then prompted, enter your username and password to log github

Here ssh to connect, for example

[email protected] clone git: fanggege123 / testhub.git # testhub generate a warehouse in the current directory 
into the directory testhub copy the code before the code within the warehouse to the here and submitted to the local repository 
git the Add. 
git the commit -m " aasdf " 
git the push Origin master # after the first put the remote repository git clone added to the local list, named origin, so in this case directly to the local branch master file can be pushed to github.

 

 Tps:

git client in order to put the local code must be submitted to the remote repository config git 
git config --global user.name " zhangsan "             # try to be on github username 
git config --global user.email " [email protected] "       # github mailbox

Notice:

If more than one person to develop the same project, if two people have changed the same file then submitted to github in A, B will be prompted to submit a conflict can not be submitted at this time need to discuss with colleagues are covered before or at the same time retained.

Covering the command

git push origin + master # + can be one more.

 

Guess you like

Origin www.cnblogs.com/fanggege/p/11440976.html