Install git for the first time and configure git without sshkey

Generate sshkey:

ssh-keygen -t rsa -C "username" (Note: username is your username on git)

If the execution is successful. return

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa): 

First of all, let me explain that the username here is the username on your computer.
Then , here is the setting of the storage address. If we press Enter directly, one of the following two situations will appear:

(1)

If it runs normally,
Enter passphrase (empty for no passphrase) will appear:
then we just press Enter

After any of the above two situations,
Enter same passphrase again will appear: press
Enter again, this time you will see:
Your identification has been saved in /Users/username/.ssh/id_rsa.
Your public key has been saved in /Users /username/.ssh/id_rsa.pub.
The key fingerprint is:
58:42:8b:58:ad:4b:b5:b9:6d:79:bf:8c:f9:e2:2b:ed
username
The key's randomart image is:

This means that the SSH key has been generated. The file directory is: /Users/username/.ssh/id_rsa.pub.
We execute the cat command to view the contents of the file:
cat /User/username/.ssh/id_rsa.pub At
this time, we will see:
ssh-rsa AAAAB3NzaC1yc2. . . . . . . . .
I omit the following content
(Note: the content after ssh-rsa is your SSH keys)
Add the displayed SSH
keys directly to the SSH keys in the github account settings and
finally execute the git clone command.

Initialize git:

You can upload your local project to your own github with just a command. . Proceed as follows:

1. Log in to your github account, as shown below:

2. Click new repository to create a new repository to store your own projects;

3. It is also the most important part, upload the project with the command;

1. cd to the root directory of the uploaded project, then initialize the local warehouse, git init

2. Add the current working directory file to the index, add management,

git add * (remember there is a dot, and there is a space between it and add)

3. View all files in the current directory that are not managed by git and files managed by git and modified but not yet submitted.

git status (if there are a lot of red files, then you need to perform step 2 again, git add. until there is no problem.)

4. Submit files, and submit the files in the temporary storage area of ​​the local warehouse to the local warehouse.

setting the infomation what show when you commit

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

git commit -m "message" where message is the comment when you submit the file. In order to know what this commit does...

5. Associate the remote warehouse, where origin is followed by the alias of the remote warehouse.

git remote add origin https://github.com/bendan321/nihao.git

6.push file.

git push -u origin master。

OK, in this case, the transfer of the local project to github is completed.

Configure ignored files, do not submit:
In gitbush:
touch .gitignore
to open the file, and add files that do not need to be submitted to the configuration file in a relative path

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324705832&siteId=291194637