I have written whole code before cloning any repo, now I decided to push entire code into new repo directly from pycharm IDE.
Do anyone know how to do that.
If you want to push the project to GitHub, just use VCS - Import into Version control - Share on GitHub.
If you want to push somewhere else, then:
Use VCS - Enable VCS integration. If there is no git repository in
the project, IDE will create one.
Mark all files you need, add them to git and commit
Add a remote using VCS - Git - Remotes
Push (VCS - Git - Push, or Ctrl+Shift+K)
first check your remote by git remote -v
add remote of new repo while creating repo you will get.
git remote add origin
git init
git add .
git commit -m "first initialize"
git push origin master
Related
So I have a public repository from my lecturer on GitLab, which I cloned into intellij via "import VCS" (https Link). Now I want to always push into my own repository in GitLab and not the public repository. How can i do this in intellij or where else can I set this up?
I already tried to copy the project into a new project and push seperately but this isnt a good solution because then i need to copy everything manually whenever new things are being added in the public repository and i cant just pull from the public repository.
The optimal solution would be, that i can pull from the public repository but push my commits into my own repository in GitLab
clone the public repository using command
git clone repo_path
git add .
git commit -m "comment"
git push origin main
You can clone your lecturer project.
Once it's done, go to Git | Manage remotes and add your private repostiory there.
Once it is added there, when you decide to Push -> go to Git | Push and then you can click on origin and choose desired remote. This way you can choose your target remote and update your local project from your teacher's repository.
I've switched to windows and am having a hard time using bitbucket with it.
Within the downloads menu you can add files but this is not added to source.
I've also tried using source tree (web application) but when I attempt to push the files they do not exist in my directory. Any idea how I can do this or a guide which explains how to upload files. It's been a number of years since I have used bitbucket on windows.
Bitbucket is simply a git provider. You'll have to use Git commands (or a GUI like Sourcetree, Gitkraken, etc.) to push (upload) your files to source.
A basic guide to working with Git can be found here.
Windows or Linux only you need a git console or git cli installed in your default cli.
First clone your repository to your local system. Go to your
bitbucket account and your repository need to be file uploaded. Copy
the git url command. Open git console and type the following command.
git clone "git URL"
Explore you repository and make changes. Like add file which you want to upload to it.
Go to your git console again and type the following commands.
git add .
git commit -m "commit message like - adding file"
git push origin master
I need to work on different branches of a project at the same time, so having multiple folders (one for each branch) would be the faster and easier solution.
The problem arises when cloning my own repo: GitHub for Windows will recognize it and automatically move it to the main repository, where i can manage only one branch at a time.
I'm new to GitHub and couldn't find any working solution/workaround for version 1.2.110
Already tried, didn't work:
Github: how to checkout my own repository
Clone Github repo to specific Windows folder?
https://stackoverflow.com/a/7803102/1193335
http://bitdrift.com/post/4534738938/fork-your-own-project-on-github
1 Create a new folder, eg: C:\GitHub\mynewbranch
2 Drag it into GitHub, fill the description fields, uncheck "Push to GitHub" and continue.
3 Open your "Repository settings":
And fill the "Primary remote (origin)" field with your repository url:
4 Click "Open in Git Shell" (below "Repository settings") and type this in the command line:
git remote set-url origin git#github.com:<username>/<repository name>.git
5 Then this:
git pull origin <branch name>
6 Switch to the desired branch in GitHub, enjoy :-)
P.S. to update future changes from the master:
git pull origin master
So I had been (stupidly) making changes directly on the live server instead of making them on my local machine and deploying them. This messed up my deployment. So now I was to do "git reset --hard".
On my remote server I have a project.git directory (for the repository... which is bare btw) and a project directory (for my actual application).
But when I try to run "git reset --hard" it tells me I'm not on a working tree. If I go into config and change bare to false... it says the same thing.
Ideas?
Found a better solution. :)
First I did a git reset --hard on the local server (since the remote server is just a bare repository.)
Then I did a git commit -a which told me there were no changes but that there were untracked files.
So I did a git add . to add all the files that weren't being tracked.
Finally I ran git commit -a again and git push.
This updated my repository with all the new files and then cap deploy functioned as expected.
I am working on a gui based helper utility that will:
Init a local repo, Init (bare) a remote repo
Add .gitignore based on a project type
Commit all the files locally
Add a remote repo to the local config
Push master to the remote repo
Create a develop branch and push it to master
All this is done without git installed by using ngit (.NET port of jgit).
But I can't figure out how to setup tracking to track master to origin/master and develop to origin/develop using just ngit.
I can do it easily with
git branch --set-upstream master origin/master
However, I was hoping to avoid the dependency of a local git install.
Here is a Java snippet that corresponds to the --set-upstream option to git branch:
Git git = Git.open(new File("/home/repos/myrepo"));
CreateBranchCommand create = git.branchCreate();
create.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
create.setName("develop");
create.setStartPoint("origin/develop");
create.call();