2012-06-30 69 views

回答

29

GitHub上给你说明你已经创建了库后,网上。

cd与本地资源库

git remote add origin whatever-address-my-repository is.git设置远程

再做出承诺,并推到主分支的目录。

git push -u origin master

https://help.github.com/articles/create-a-repo

+1

'git的远程添加原产什么地址,我的仓库是。 git'和'git push origin HEAD:master' –

+0

太好了,谢谢!另外,我该如何让git不要每次都问我用户名? – corazza

+0

@Bane一旦你已经将你的repo添加到远程,只需在提交之后用'git push -u origin master'推送它即可。你只会被问你的ssh密钥。 – nims

4

1.创建一个README.md在你的本地仓库(用于GitHub - *optional

2. git remote add origin <your_URL_for_github_repo.git>

(您可以通过输入git remote -v来验证您是否有origin。您可以看到<URL>.gitorigin)。

3.Make提交由git commit -a -m "<a message>"

(重要!只有提交的文件将被推到Github上)由git push -u origin master

4.Now推GitHub上(如果你推主分支)。

您将您每按一次需要密码(如果您使用克隆https:)。为了摆脱那个;

在终端,输入以下命令:

git config --global credential.helper cache 
# Set git to use the credential memory cache 

要更改默认密码缓存超时,输入以下命令:

git config --global credential.helper 'cache --timeout=3600' 
# Set the cache to timeout after 1 hour (setting is in seconds) 
相关问题