git push the project to the cloud code (gitee)

git push the project to the cloud code (gitee)

git push the project to the cloud code (gitee)

Create an account

Create a Gitee account, I am using Gitee because domestic fast speed ~

Local install Git

Go Git Git according to the local operating system download

ssh key

Locally generated secret key, right-click the desktop to open needs to be generated when you git bash first use Git ssh

ssh-keygen -t rsa -C "your_email"

Generated keys in general the .ssh directory under your operating system users

Tell the local system

The key is to tell the local system

ssh-add ~/.ssh/id_rsa

(Here if there Could not open a connection to your authentication agent. Executes first ssh-agent bash)

View public key generated

cat ~/.ssh/id_rsa.pub

Upload public

Copy and paste the public key to the SSH public key on your Gitee page, use SSH public key allows you to use a secure connection when your PC and the cloud communications code (Git to use the Remote SSH address)

User Configuration

Open git bash needs to be configured:

git config --global user.name "your_Name"
git config --global user.email"your_email"

Initialize the local Git repository

git init

This command after the implementation will be more of a .git folder

Add change file

git add . // 表示添加全部变更文件

Submission

git commmit -am "message" // 表示提交全部变更文件

Adding remote address

git remote add origin [email protected]:你的gitee用户名/仓库名.git

ssh test

ssh -T [email protected]

Show Welcome to Gitee.com, your user name! Description ssh correct.

Possible errors

If the fatal appear: remote origin already exists is executed.

git remote rm origin

Initial submission

The first may be submitted will receive an error

error: failed to push some refs to 'https://gitee.com/tomFat/interview.git'

So we need to perform before submitting

git pull

Merge the two repositories

git pull origin master --allow-unrelated-histories

Push to Github or Gitee

git push -u origin master 

Or master # git push warehouse name on your gitee pushed to the designated warehouse master branch

Or git push -u origin master -f # Forced push

Guess you like

Origin www.cnblogs.com/guoyinghome/p/11229750.html