linux git 配置。

來源:互聯網
上載者:User

 

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環境遇到了一些問題,稍作記錄吧。

說明:以下內容絕大部分來自於:https://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 directorySince 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_hostsmkdir key_backup# Makes a subdirectory called "key_backup" in the current directorycp id_rsa* key_backup# Copies the id_rsa keypair into key_backuprm id_rsa*# Deletes the id_rsa keypairTo 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.comStep 4: Add your SSH key to GitHubRun 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 clipboardBe 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 SettingsClick "SSH Keys" in the left sidebarClick "Add SSH key"Paste your key into the "Key" fieldClick "Add key"Confirm the action by entering your GitHub password


5,建立一個本地程式碼程式庫

 

Step 1: Create the README fileIn the prompt, type the following code:mkdir ~/Hello-World# Creates a directory for your project called "Hello-World" in your user directorycd ~/Hello-World# Changes the current working directory to your newly created directorygit 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 directoryStep 2: Commit your READMENow 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 commitsgit add README# Stages your README file, adding it to the list of files to be committedgit commit -m 'first commit'# Commits your files, adding the message "first commit"Step 3: Push your commitSo 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 remotesgit remote add origin https://github.com/username/Hello-World.git# Creates a remote named "origin" pointing at your GitHub repogit push origin master# Sends your commits in the "master" branch to GitHub

 

6,git 命令無法自動補全解決方案:

參見以下部落格:ClickMe!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.