设为首页 收藏本站
查看: 928|回复: 0

[经验分享] linux git 环境安装配置

[复制链接]

尚未签到

发表于 2016-2-11 16:31:47 | 显示全部楼层 |阅读模式
  
  win8承载了微软太多的期望,希望以此来一统桌面PC和移动手机市场,也弄出了很多的动静和噱头。正好同事下载了win8RC于是就用虚拟机VMware尝尝鲜。
  安装中并没有让我产生第一次装win7时的那种震撼和惊艳,进去了是早有耳闻的方块元素,默认壁纸也没有win7的耐看。(win7默认壁纸到现在也没换过)
  试用了30分钟实在没有用下去的想法,UI做如此大的变革实在是一件风险极大的事情,可以说是一种强X用户习惯和体验之举,比如没有开始菜单就让我极其反感。
  强烈感觉NOKIA这么一个伟大的手机公司被微软坑了,就metro这德性,NOKIA振兴的那天估计是很难看到了。
  扯远了,有了VMware我也顺便装了一个最新的ubuntu 12.04,第一感觉又是习惯被强X了,你大爷的Unity,做的都没360桌面好看,你大爷的要求我换那些用习惯了工具,搜了网上一坨人也在抱怨,解决方案是自己安装Gnome,可是只能装Gnome3,但这货菜单条又缺少网络链接和登出选项,不想折腾了,果断装回了Ubuntu10.10.(我同事也因为类似原因改用linuxMint了)。重配Git环境遇到了一些问题,稍作记录吧。
  说明:以下内容绝大部分来自于:github.com。
  1,下载git
  

$ apt-get install git-core
  
  2,配置个人信息(非必须)。
  

git config --global user.name "Your Name Here"
git config --global user.email "your_email@youremail.com"

  3,设置密码缓存时间

/**To use this option, you need to tur
*n on the credential helper so that git
*will save your password in memory f*or some time:
*/
git config --global credential.helper cache
# Set git to use the credential memory cache
//By default git will cache your password for 15 minutes. You can change this if you like.
git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)

  4,配置远程github库ssh密码

First, we need to check for existing ssh keys on your computer. Open up Git Bash and run:
cd ~/.ssh
# Checks to see if there is a directory named ".ssh" in your user directory
Since there is already an SSH directory you'll want to back the old one up and remove it:
ls
# Lists all the subdirectories in the current directory
# config  id_rsa  id_rsa.pub  known_hosts
mkdir key_backup
# Makes a subdirectory called "key_backup" in the current directory
cp id_rsa* key_backup
# Copies the id_rsa keypair into key_backup
rm id_rsa*
# Deletes the id_rsa keypair
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.
ssh-keygen -t rsa -C "your_email@youremail.com"
# Creates a new ssh key using the provided email
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]
Now you need to enter a passphrase.
Why do passphrases matter?
# Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]
Which should give you something like this:
# Your identification has been saved in /c/Users/you/.ssh/id_rsa.
# Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@youremail.com
Step 4: Add your SSH key to GitHub
Run the following code to copy the key to your clipboard.
clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
Be warned: it is important to copy the key exactly without adding newlines or whitespace. Thankfully the clip command makes it easy to perform this setup perfectly.
Go to your Account Settings
Click "SSH Keys" in the left sidebar
Click "Add SSH key"
Paste your key into the "Key" field
Click "Add key"
Confirm the action by entering your GitHub password

   
  5,建立一个本地代码库
  

Step 1: Create the README file
In the prompt, type the following code:
mkdir ~/Hello-World
# Creates a directory for your project called "Hello-World" in your user directory
cd ~/Hello-World
# Changes the current working directory to your newly created directory
git init
# Sets up the necessary Git files
# Initialized empty Git repository in /Users/you/Hello-World/.git/
touch README
# Creates a file called "README" in your Hello-World directory
Step 2: Commit your README
Now that you have your README set up, it's time to commit it. A commit is essentially a snapshot of all the files in your project at a particular point in time. In the prompt, type the following code:
More about commits
git add README
# Stages your README file, adding it to the list of files to be committed
git commit -m 'first commit'
# Commits your files, adding the message "first commit"
Step 3: Push your commit
So far everything you've done has been in your local repository, meaning you still haven't done anything on GitHub yet. To connect your local repository to your GitHub account, you will need to set a remote for your repo and push your commits to it:
More about remotes
git remote add origin https://github.com/username/Hello-World.git
# Creates a remote named "origin" pointing at your GitHub repo
git push origin master
# Sends your commits in the "master" branch to GitHub

  
  6,git 命令无法自动补全解决方法:
  参见以下博客:ClickMe!
  
补充:因为VMware是要收费的,费用也很高,所以换开源的virtualBox了,挺好用的,就是分辨率上遇到些问题,装上拓展包后就基本解决了:


sudo apt-get install virtualbox-ose-guest-utils virtualbox-ose-guest-x11 virtualbox-ose-guest-dkms
  
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-176526-1-1.html 上篇帖子: Linux下GIT安装 下篇帖子: linux git 简单搭建
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表