从delphi代码将文件推送到GIT版本控制的问题

时间:2014-05-13 07:23:28

标签: git delphi github

我试图将文件提交到GIT,然后从delphi代码将它们推送到GIT HUB。

请参阅以下代码:

我的访问权限受到侵犯:

git_remote_connect(远程,GIT_DIR_PUSH); git_remote_pushspec(远程);

uses uGitForDelphi;

procedure TfrmMain.CommitClick(Sender: TObject);
var
   repo: Pgit_repository;
   commit: Pgit_commit;
   tree_id, parent_id, commit_id: git_oid;
   author, committer: Pgit_signature;
   author1, committer1: Pgit_signature;
   parent: Pgit_commit;
   tree: Pgit_tree;
   index: Pgit_index;
   head, branch: Pgit_reference;
   remote: Pgit_remote;
   const
   branch_name: PAnsiChar = 'refs/heads/master';
begin

   git_repository_open(repo, REPOSITORY_FOLDER);

   git_oid_fromstr(@tree_id, tree_oid);


   git_oid_fromstr(@parent_id, PAnsiChar(commit_ids[4]));


   git_reference_lookup(head, repo, 'HEAD');
   git_reference_set_target(head, branch_name);

   git_repository_index(index, repo);
   git_index_entrycount(index);
   git_index_add(index, 'TestingNewfile.txt', 0);

   //* create signatures */
   git_signature_new(committer, COMMITTER_NAME, COMMITTER_EMAIL, 123456789, 60));
   git_signature_new(author, COMMITTER_NAME, COMMITTER_EMAIL, 987654321, 90));

  git_commit_create_v(
      @commit_id, //* out id */
      repo,
      'Head', //* do not update the HEAD */
      author,
      committer,
      nil,
      COMMIT_MESSAGE,
      tree,
      1, parent));

   git_commit_lookup(commit, repo, @commit_id));

   //* Check attributes were set correctly */
   author1 := git_commit_author(commit);

    committer1 := git_commit_committer(commit);

   *git_remote_new(remote,repo, 'https://github.com/iambasiljoy/Jungle', 'Jungle');
   git_remote_connect(remote,GIT_DIR_PUSH);
   (git_remote_pushspec(remote));
 //  git_commit_free(commit);
//   git_repository_free(repo);*
end;

我在下面的行中遇到访问冲突。

git_remote_connect(远程,GIT_DIR_PUSH); git_remote_pushspec(远程);

任何人都可以告诉我这里缺少什么,以及如何连接github并从代码中推送一些文件。

由于 Bjoy

0 个答案:

没有答案