upload local files to git github

upload local files to git github

1 git config --global user.name "Your Real Name" 
2 git config --global user.email [email protected]

git init

git add .

git commit -m 'Test'

git remote add origin [email protected]:XXX/XXX.git 3 git push -u origin master

Some solve problems you might encounter: 
Assuming that the input $ git remote add origin [email protected]: djqiang (github account name) / gitdemo (project name) .git 
prompt an error message: fatal:. Remote origin already exists 
solutions such as the following: 
1, first enter the Remote RM Origin git $ 
2, then enter the $ git remote add origin [email protected]: djqiang / gitdemo.git would not have given up! 
3, assuming that the input $ git remote rm origin is still being given anything, error: Could not remove config section 'remote.origin' We need to change the contents of the file gitconfig. 
4, find the installation path of your github, I is C: \ Users \ ASUS \ AppData \ Local \ GitHub \ PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8 \ etc 
5, find a file named gitconfig open it to the inside of the [remote "origin"] delete the line just fine. 
Assuming that the input $ ssh -T [email protected] 
error message appears:. Permission denied (publickey) due to the new generation of the key can not be increased ssh will lead not connect github. 
The solution such as the following: 
1, to enter $ ssh-agent. Enter $ ssh-add ~ / .ssh / id_key, so that on it.

2, it is assumed or not, then enter ssh-add ~ / .ssh / open a connection to your authentication agent given Could not id_key after the command. The solution is key generation Git Gui of ssh tools, thus generated when key directly stored in ssh in, and do not need to re-ssh-add command adds. Other user, token and other configurations are done using the command line. 3, it is best to check there are no extra spaces or blank lines when you copy the contents of id_rsa.pub file, some editors will help you increase these. Assuming that the input $ git push origin master prompt an error message: error: failed to push som refs to ....... The solution such as the following: 1, first enter the $ git pull origin master // first remote servergithub pulled down the top of the file 2, Push enter Git Origin Master $ . 3, given are assumed to appear fatal: Could not find remote ref master or fatal: 'origin' does not appear to be a git repository and fatal:. Could Not Read from Remote Repository . 4, but also the need to enter a $ git remote add [email protected]: djqiang / gitdemo.git use git to create a project in the local process $ makdir ~ / hello-world // create a hello-world project $ Cd ~ / hello-world // open the project $ Git init // initialize $ Touch README $ git // update the Add README README file $ git commit -m 'first commit' // submit updated information and stare "First the commit" $ git the Add Remote Origin [email protected]: defnngj / hello-world.git // connect to a remote github project $ git push -u origin master // update the local project up to github project


Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:teamtogether/TestProject.git
git push -u origin master

Push an existing repository from the command line

git remote add origin [email protected]:teamtogether/TestProject.git
git push -u origin master



Guess you like

Origin www.cnblogs.com/mqxnongmin/p/10941801.html