小白一个,想在服务器上实现Git的版本控制这么一件事情,折腾了很久。记录一下遇到的问题和解决:
git clone my repository
It turns out that
Connection timed out. Fatal: The remote end hung up unexpectedly.
This took 3 days to find out the possible solution. Yesterday, I was having a small talk to lab mate. I was asking “hey, is there any problem when we use hlogin host?” “Which one do you refer exactly?” “hlogin07“”That one is unable to wget or git”
I was like …… SHIT!
so I changed it to @hlogin03.ihep.ac.cn. Well, clone process works fine now.
git push my update
after git add and git commit, I carry out git push origin master. Another error occurred
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/tuoyl/hxmtanalysis.git/info/refs
fatal: HTTP request failed
So I checked what the heck is that 403 Forbidden stuff. And google feeds me back that this is due to some version problem. Yeah, of course, the Git version on the server is the old school version which they prefer, RollingMyEyes.
Anyway, there is another approach fixing it, remote my git with ssh instead of HTTP format(something like that).
So I run git remoter set-url ssh://git@github.com/tuoyl/hxmtanalysis.git, and git push again after it. Guess what, I don’t have an SSH key for this GitHub account. I really know nothing on this.
Add an SSH key associated with my account
An SSH key was generated on the server first:
ssh-keygen -t rsa -b 4096 -C “crazyuni1993@gmail.com”
add a key associated with my GitHub account, setting — SSH and GPG keys, which took me a while to find it.
copy the information within ~/.ssh/id_rsa to fill in the table when adding an SSH key on GitHub.
Well, you pretty much good to run! Cheers!