In your work, you will sometimes encounter that the url of your git submission code has been moved to another URL, so the URL of your local project will also be moved to another url
Start by looking at the location of your project git code
git remote
— Lists existing remote branches without parametersgit remote -v | --verbose
—- lists the details, with each name followed by its remote URL
origin git://github.com/schacon/ticgit.git (fetch)
origin git://github.com/schacon/ticgit.git (push)
Copy the code
git remote set-url origin git://github.com/schacon/ticgit222.git
Change the —– project git url to a new onepush
The codegit remote -v
Origin git://github.com/schacon/ticgit222.git (fetch) origin git://github.com/schacon/ticgit222.git (push) has already become the new url, This will allow for normal pull and push codeCopy the code
At work, SSH keys are sometimes added, and then HTTP submissions are turned off, so people who haven’t tied SSH can’t push code
Link: Technical source CSDN’s Fishing song to the Late Big guy
Create an SSH Key to connect to Github or GitLab
- First you need to have an account on Github or GitLab
- Open git bash and type the command
ls -al ~/.ssh
. Check whether there areid_rsa.pub
orid_dsa.pub
There are
$ls-al ~/. SSH Total 241 drwxr-xr-x 1 Dragon 1049089 drwxr-xr-x 1 Dragon 1049089 rw-r--r-- 1 Dragon 1049089...... ... ... ...Copy the code
- Or you could just go to your computer and check it out
User > dragon >. SSH
在.ssh
directory
$ls known_hosts... ... ...Copy the code
- Type in Git bash
Ssh-keygen -t rsa -c "Your own email address is good @example.com"
Replace the email address here with your own. Just keep pressing Enter after that. You can see it hereid_rsa
andid_rsa.pub
The file has been generated. The generated path is also displayed. - Open it with software
id_rsa.pub
File, and copy the entire contents togitlab
orgithub
Open the accountSSH key
TAB, and then clickadd key
. The public key information is recorded here. - Once that’s done, you can proceed with git as long as you have permission on the project you want to operate.
- If you’re new to the computer, nothing has to be done first:
-
git config --global user.name karsuo.he
.
-
git config --global user.email [email protected]
-
ssh-keygen -t rsa -C [email protected]
conclusion
React QQ group:
788023830
—-React/Redux - Old underground hero
Front-end COMMUNICATION QQ group:
249620372
—-FRONT - END - JS FRONT END
(Our mission is, for overtime, for baldness… , look up to the big guy), I hope friends to study together