我对github很新,想知道如何将本地项目推送或设置到远程环境?例如,我在C:\ project中有一个项目,如何将它发送给github remote?使用git控制台时我一直失败。任何步骤?如何将本地git项目设置为远程?
0
A
回答
1
下面的网站会给出一个暗示要做什么。我认为这会有所帮助。 https://help.github.com/articles/pushing-to-a-remote/
1.首先重定向到您要设置的git项目。
的git的init
git的添加*
混帐推
3
步骤使用:
create a local repository, if not yet,
commit local repository locally,
git add .
git commit -am "init"
create a repository on github with same name as local repo:
left it empty, no README or .gitignore file,
config remote:
git remote add origin https://github.com/[user]/[project_name].git
set remote url:
git config remote.origin.url https://[user]@github.com/[user]/[project_name]
initial push to github:
git push -u origin master
set tracking info - master:
git branch --set-upstream-to origin/master
tip:
before do this, the remote repo should at least contain 1 commit,
you can do this by push once, or create a file remotely (e.g. README.md).
check the project on github, to see is it ok.
如果你有多个本地分支,你想跟踪多个分支github上,不只是主人。
steps - push another branch to github:
* make sure both local/remote have the same branch already,
if not yet, you can push a local branch to remote first,
format:
git push [remote] [branch]
* in local
switch to specific branch,
then set its upstream via:
git branch --set-upstream-to=<remote>/<remote_branch> <local_branch>
e.g.
git branch --set-upstream-to=origin/develop develop
*
学习的地方混帐
- git-scm.com/documentation
人混帐XXX
xxx是git的内部命令名,例如添加
1
如果你当前的工作文件夹没有被Github的初始化,然后使用以下命令:
git init
git remote add origin <the http git address of your remote repository>
git add .
git commit -m "<some comments for this commit>"
git push origin master
如果您的工作副本已初始化,并且您想要将远程目标存储库更改为另一个。然后,我相信下面的命令将帮助:
git remote set-url origin <the address of your new repository>
git add .
git commit -m "<some comments>"
git push origin <the branch you want to push to>
希望这个答案是非常有用的!
相关问题
- 1. 将git项目从本地移动到远程,如何?
- 2. 将远程合并到git项目的本地子目录中
- 3. 如何为多个项目设置git?
- 4. GIT新手,并尝试设置本地/远程开发设置
- 5. 如何设置镜像远程git存储库的本地目录?
- 6. 如何git拉远程和删除.git(重新)初始化本地项目?
- 7. 将本地Git分支重置为远程
- 8. 将本地Git权限重置为远程的权限
- 9. 如何设置本地ede项目
- 10. 重置本地git回购到远程?
- 11. 将远程git克隆到本地
- 12. Git:将远程分支拉到本地
- 13. 本地化项目设置
- 14. 从本地项目文件夹推送到远程git仓库
- 15. 设置git远程来源
- 16. Git如何在本地嵌套远程目录?
- 17. 本地Netbeans设置与远程git存储库
- 18. 如何使用LibGDX项目设置git
- 19. 如何设置我的本地Git存储库以使用远程服务器?
- 20. 如何在本地将一个git远程连接到另一个远程
- 21. Git - 如何将远程分支合并到远程主设备
- 22. 如何为0.3.0 mapsforge设置本地项目库
- 23. Xcode 4 git:'移动'本地git项目到我们的远程服务器
- 24. git其他人如何使用我的本地作为远程
- 25. 本地客户端服务器Xcode项目的Git设置
- 26. 如何为git存储库设置默认的远程原点?
- 27. Git-tfs重置为远程
- 28. PHP - 本地VS远程设置
- 29. git项目的Eclipse设置
- 30. GIT :(Kohana)项目设置
'我在使用git console时失败了'如果你用控制台解释你正在尝试的内容,它可能会有所帮助 – gturri