我如何从我的计算机导入源代码到我的GitHub帐户?
当前回答
我的解决方案:
问题是文件大小不能超过100M。
在迁移到github之前,在存储库中这样做:
git clone --mirror git://example.com/some-big-repo.git
wget http://repo1.maven.org/maven2/com/madgag/bfg/1.12.12/bfg-1.12.12.jar
mv bfg-1.12.12.jar bfg.jar
java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
cd some-big-repo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push
准备好了!
现在再次使用工具https://github.com/new/import进行迁移
看到更多: 推到github回购时出错 而且 https://rtyley.github.io/bfg-repo-cleaner/
希望我能帮到你。:)
其他回答
其中一条评论提到了使用GitHub GUI,但它没有提供任何具体的使用帮助,并注意到大多数(如果不是所有的话)答案只在命令提示符下有用。
如果你想使用GitHub GUI,你可以按照以下步骤:
Click the "+" button and choose "Add Local Repository" Navigate to the directory with your existing code and click the "Add" button. You should now be prompted to "Create a new local Git repository here" so click the "Yes" button. Add your "Commit Summary" and "Extended description" as desired. By default, all of your files should selected with checkmarks already. Click the "Commit & Sync" button. Now you will be prompted to add the name and description of your project as well as which account to push it to (if you have multiple). Click the "Push Repository" button
在旋转GitHub图标后,您的源代码将属于本地存储库,并在您的GitHub帐户上推送/同步到远程存储库。所有这些都假设您之前已经设置了GitHub GUI、您的GitHub帐户和SSH密钥。
实际上,如果你选择在GitHub上创建一个空的repo,它会给你确切的指令,你几乎可以复制和粘贴到你的终端(在这个时间点):
…or create a new repository on the command line
echo "# ..." >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:<user>/<repo>.git
git push -u origin master
正如JB非常正确地指出的那样,在GitHub上,只要简单地按照说明进行操作就变得非常容易。
下面是登录时使用http://github.com/new在GitHub上设置新存储库后显示的说明示例。
Global setup:
Set up Git:
git config --global user.name "Name"
git config --global user.email email@gmail.com
Next steps:
mkdir audioscripts
cd audioscripts
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:ktec/audioscripts.git
git push -u origin master
Existing Git repository?
cd existing_git_repo
git remote add origin git@github.com:ktec/audioscripts.git
git push -u origin master
Importing a Subversion repository?
Check out the guide for step-by-step instructions.
再简单不过了!!
从Bitbucket都:
向上推一个现有的存储库。您的计算机上已经有了Git存储库。让我们把它推到Bitbucket:
cd /path/to/my/repo
git remote add origin ssh://git@bitbucket.org/javacat/geo.git
git push -u origin --all # To push up the repo for the first time
添加一个GitHub存储库作为远程源(将[]替换为您的URL):
git remote add origin [git@github.com:...]
切换到你的主分支并复制它来开发分支:
git checkout master
git checkout -b develop
将你的开发分支推到GitHub的开发分支(-f表示force):
git push -f origin develop:develop
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- 在GitHub上有一个公共回购的私人分支?
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- 只用GitHub动作在特定分支上运行作业
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 是否有一个链接到GitHub下载文件的最新版本的存储库?